[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Tue Apr 26 19:10:12 2005 -->
- <!--x-from-r13: psbjyre ng bhgcbfgfragvary.pbz (Quevfgbcure Tbjyre) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Perl threads -->
- <li><em>date</em>: Tue Apr 26 19:10:12 2005</li>
- <li><em>from</em>: cfowler at outpostsentinel.com (Christopher Fowler)</li>
- <li><em>in-reply-to</em>: <<a href="msg00700.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg00700.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Perl threads</li>
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
> <a rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00725" href="msg00725.html">[ale] Perl threads</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00700" href="msg00700.html">[ale] Perl threads</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00700.html">[ale] Perl threads</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00702.html">[ale] superblock recovery?</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00700.html">[ale] Perl threads</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00725.html">[ale] Perl threads</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00701"><strong>Date</strong></a></li>
<li><a href="threads.html#00701"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>