[ale] Perl threads
Christopher Fowler
cfowler at outpostsentinel.com
Tue Apr 26 19:10:12 EDT 2005
I looked at perthrtut and there seems to be a lock() function but no
unlock. I want to lock a variable in the main program as well as a
thread.
Like this:
sub _print {
lock($lock_var)
opeN(LOG, ....
.....
return;
}
...
_print "outside thread";
async {
_print "In thread";
};
_print "outside thread";
On Tue, 2005-04-26 at 18:06, Christopher Fowler wrote:
> I'm writing a program to use threads in Perl. I have replaced print
> with _print that will place a time stamp before each entry in the log
> file. I want to make sure that two _print executions do not step on
> each others toes. Is there a way to create a variable and lock it like
> I would in Posix threads? I could then lock on entry of _print and then
> unlock on exit.
>
> Chris
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list