[Coco] Can a Basic09 program tell which screen or terminal it is running in ?
Gene Heskett
gheskett at shentel.net
Thu Oct 17 23:14:45 EDT 2019
On Thursday 17 October 2019 19:55:43 coco at jechar.ca wrote:
> I was thinking of how a Basic09 program using
> temporary files in a multiprocess environment
> could be sure not to overwrite another process
> files.
>
> For example if Program A was puting data in
> /r0/out.temp and Program B was trying to do
> the same thing problems.
>
> One possible solution
> Suppose Process A is running in /term and process
> B is running in /w3 then if the process could
> determine which window it was running in it could
> add that info to the temporary file name,
> ie.
>
> Process A saves to /r0/out-term.temp and
> Process B saves to /r0/out-w3.temp
>
> No problem.
>
> So I was wondering how could Process A figure out
> that it was running in /term ect. ?
>
> Charlie
Charlie: nitros9's file locking is by the active sector, and will not
allow 2 processes to access the same sector. I used to start a long
assembly, directing the listing to a file, give it 2 or 3 seconds to get
started, go to another window and start listing that file, and it never
once overtook the assembler & listed the disk trash ahead of the
assembler.
This is in a stark contrast to most operating systems which lock the
whole file. Nitros9 won't complain as long as there is a first sector
already written. Your idea could also be implemented using the random
number generator as part of the filename, with a clash via a repeat of
the same number being a faint possibility.
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
- Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>
More information about the Coco
mailing list