Re: Is POE thread safe?
Rocco Caputo <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
I think you misunderstand. POE synchronously calls all event handlers. It's up to other modules or applications to introduce preemptive concurrency. As presented, the examples you've shown don't introduce preemptive concurrency, so there should be no problem with them accessing "shared" resources. -- Rocco Caputo - [email protected] On May 23, 2009, at 23:17, howard chen wrote: > Hello, > > On Sun, May 24, 2009 at 4:00 AM, Rocco Caputo <[email protected]> > wrote: >> In this case, response_handler() is always synchronized. >> > > Thanks for reply. > > > "In this case" do you mean in POE::Component::Client::HTTP or in > generic POE handler? > > For example, if I create session this way... > > for (1..10) { > POE::Session->create( > inline_states => { > _start => \&handler_start, > increment => \&handler_increment, > _stop => \&handler_stop, > } > ); > } > > > > > Is the handlers - "handler_increment" also synchronized so my global > object can be safely accessed? > > Thanks. > > Thanks.