[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] is there a logging module available?



On Thu, 22 Apr 1999 07:50:53 -0400, Chris Nandor wrote:

>Actually, a way you could do it in MacPerl would be to hold the file open
>for writing.  That forces it into a systemwide mandatory lock ... except
>for the MacPerl program itself.  So it would prevent others from opening it
>for writing, but if you are running multiple scripts within MacPerl (say,
>when MacPerl has threading), then it might not do anything to prevent other
>MacPerl scripts from opening it for writing.

Are you sure? That would be a very messy behaviour, and it ought to be
patched, if it is indeed so. You may open a file for writing only once
at a time, period.

At least, that is how it is in AppleScript. Try this "script":

	set handle to (open for access file "semaphore file" \
		with write permission)  -- all in one line

Run it twice in the Script Editor. The first time it works, the second
time you get the error: "file is already open".

You need to quit and restart the Script Editor, to be able to run it
again. So the file *IS* locked because it is open (even for the same
program), and shutting down the program automatically closes it.

I don't think the AS engine is that smart. So my sincere hope is that it
is really the underlying OS, that takes care of these things. Therefore,
a threading MacPerl may well do "the right thing". Hopefully.

	Bart.

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org