Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #1095 > unrolled thread
| Started by | Thomas Milius <Thomas-Milius@t-online.de> |
|---|---|
| First post | 2011-11-29 21:02 +0100 |
| Last post | 2011-11-30 19:40 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.sys.acorn.programmer
Clean up in case of quitting a task window Thomas Milius <Thomas-Milius@t-online.de> - 2011-11-29 21:02 +0100
Re: Clean up in case of quitting a task window "David Holden" <SpamBin@apdl.co.uk> - 2011-11-29 20:51 +0000
Re: Clean up in case of quitting a task window Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-11-30 07:58 +0100
Re: Clean up in case of quitting a task window Thomas Milius <Thomas-Milius@t-online.de> - 2011-11-30 19:40 +0100
| From | Thomas Milius <Thomas-Milius@t-online.de> |
|---|---|
| Date | 2011-11-29 21:02 +0100 |
| Subject | Clean up in case of quitting a task window |
| Message-ID | <d537e43952.Thomas@thomas-milius.t-online.de> |
I am running a BASIC program inside a task window. It is opening a couple of files. I want to close these files in case that the Taskwindow is quit. How can I achieve this? ON ERROR doesn't seem to get aware of the quit. A complicated possibility might be the installation of a wimp post filter written in assembler in BASIC but this all complicated. Many thanks in advance for any hints. Best Regards Thomas Milius
[toc] | [next] | [standalone]
| From | "David Holden" <SpamBin@apdl.co.uk> |
|---|---|
| Date | 2011-11-29 20:51 +0000 |
| Message-ID | <9jkutnFd3aU1@mid.individual.net> |
| In reply to | #1095 |
On 29-Nov-2011, Thomas Milius <Thomas-Milius@t-online.de> wrote: > I am running a BASIC program inside a task window. It is opening a couple > of files. I want to close these files in case that the Taskwindow is quit. > How can I achieve this? I would suggest that you don't leave files open unless you're actually accessing them. It's common practice to open a file and leave it open until the program quits or it's completely finished with. If you open the file, read/write the data, then immediately close the file the opportunities for anything external to cause problems are minimal. -- David Holden - APDL - <http://www.apdl.co.uk>
[toc] | [prev] | [next] | [standalone]
| From | Rick Murray <heyrickmail-usenet@yahoo.co.uk> |
|---|---|
| Date | 2011-11-30 07:58 +0100 |
| Message-ID | <4ed5d431$0$5677$ba4acef3@reader.news.orange.fr> |
| In reply to | #1095 |
On 29/11/2011 21:02, Thomas Milius wrote:
> I am running a BASIC program inside a task window. It is opening a couple
> of files. I want to close these files in case that the Taskwindow is quit.
> How can I achieve this?
You don't.
I'm not certain if, even, a C atexit() would work in this case?
Essentially TaskWindow allows non-multitasking programs to multitask. It
is reasonable for a non-multitasking program to assume that something
else isn't going to come along and quit it.
There doesn't appear, strangely enough, to be even a Service call for
"TaskWindow_TaskDying" or somesuch.
So, your options:
1. Only have files open as you actually need them. You'll need to look
to see if you need to make some sort of locking mechanism (to block
two different copies of your software working with the same file at
the same time, risking one copy trashing data written by the other)
2. Rewrite it as a proper multitasking program.
[I'll admit, scrolling screen output is complicated, but there may
be other ways around that, like a slidey-bar thing counting up
progress instead of lines of output]
Best wishes,
Rick.
[toc] | [prev] | [next] | [standalone]
| From | Thomas Milius <Thomas-Milius@t-online.de> |
|---|---|
| Date | 2011-11-30 19:40 +0100 |
| Message-ID | <9691603a52.Thomas@thomas-milius.t-online.de> |
| In reply to | #1102 |
In message <4ed5d431$0$5677$ba4acef3@reader.news.orange.fr>
Rick Murray <heyrickmail-usenet@yahoo.co.uk> wrote:
> On 29/11/2011 21:02, Thomas Milius wrote:
>
> > I am running a BASIC program inside a task window. It is opening a couple
> > of files. I want to close these files in case that the Taskwindow is
> > quit. How can I achieve this?
>
> You don't.
>
> I'm not certain if, even, a C atexit() would work in this case?
>
I think a C-event would be launched so C atexit() would work, but yes the
program is in BASIC. It is a little program watching an USB Port for
asynchronous Messages and writing some results into a log file.
I have meanwhile searched around and in 2005 there was a similar thread.
Several people at that time suggested to claim the event handler of the
TaskWindow task. I shall try this. Of course I shall have to write some
line in assembler but I think only some lines.
Many thanks for the hints.
Best Regards
Thomas Milius
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.acorn.programmer
csiph-web