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

[no subject]



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
&gt; <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>