Re: Is POE thread safe?

Rocco Caputo <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
In this case, response_handler() is always synchronized.

-- 
Rocco Caputo - [email protected]


On May 23, 2009, at 14:52, howard chen wrote:

> Hey,
>
> For example, in POE::Component::Client::HTTP
> (http://search.cpan.org/~rcaputo/POE-Component-Client-HTTP-0.88/lib/POE/Component/Client/HTTP.pm
> ), the default max_per_host is 4.
>
>
> So is it always safe to do the following? (i.e. is the handler
> "response_handler" synchronized?)
>
>
> my $obj = MyClass->new(); # has member variable $data;
>
> ...
> sub response_handler {
>
>    $obj->{data} = RANDOM_NUM;
>
>    print $obj->{data}; # should princt exactly the RANDOM_NUM above,
> not the other  RANDOM_NUM set by other thread/process
>
> }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.