Foo Ji-Haw wrote:

> Hello Brian,
> 
> Thanks for responding to my call for help.
> 
> Thanks for confirming my concerns on objects not being able to share
> across threads. I have a logger object which I want my
> threads to share
> and use. Is there any good workaround on this, short of just
> calling the
> class methods?

It might be worth trying the Perl Monks (www.perlmonks.org), someone
there may some ideaas on sharing objects.

Also, if you run your 'logger' in its own thread and pass data to it via
a queue, you don't need to share it (the queue is shared).

> 
> To clarify: I have the daemon run on its own thread. The main
> application spawns the daemon, which spawns the worker threads.
> 
> I will want the main application to periodically close all
> threads and
> restart them (I don't feel too comfortable with the stability
> of threads
> in Perl yet). So maybe after sleeping for 6 hours, it will stop and
> start the daemon thread. 

Then perhaps its not a good idea to use threads, at least not for
production code, or anything important.

> 
> I don't know if it is because my coding is too poor, but sometimes my
> threads will hang while processing stuff. If I can restart
> the threads
> regularly, it can be a safety net.

If your threads are hanging then you should try to fix that. There is no
guaranteed safe way to shut them down without terminating the program,
and sometimes not even then.

HTH

-- 
Brian Raven
 


-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
-----------------------------------------------------------------------


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to