> If you have a (simple) testcase that demonstrates the > problem I'd be happy to take a look at it.

Here is a simple POE::Component:IKC implementation. You'll have to run both with different processes. Uncommenting the server's async call throws an exception on win32 with ActiveState Perl. Any ideas how to make POE really thread-safe?

Kind regards.

Michael.

For the sample code,
SERVER IMPLEMENTATION
# ==================================================================== +========== # SERVER IMPLEMENTATION # exec: perl src.pl # ==================================================================== +========== #!/usr/bin/perl -w # ==================================================================== +========== use strict; use POE qw(Session); use POE::Component::IKC::Server; use POE::Component::IKC::Specifier; use threads; # ==================================================================== +========== my $port = '32032'; my $ip = '127.0.0.1'; my $name = 'ThreadTest'; my $alias = 'TT'; # === INTER KERNEL COMMUNICATION ===================================== +========== create_ikc_server( ip => $ip, port => $port, name => $name ); POE::Session -> new ( # --- general states --------------------------------------------- +------ _start => \&start, # session start # --- service requests ------------------------------------------- +------ 'call' => \&call, # ---------------------------------------------------------------- +------ ); $poe_kernel->run(); # === IKC STATES ===================================================== +========== sub start { my($kernel, $heap) = @_[KERNEL, HEAP]; print "State [start]\n"; $kernel -> alias_set( $alias ); $kernel -> call( 'IKC', 'publish', $alias, [ qw( call ) ] ); } # ==================================================================== +========== sub call { my($kernel, $heap, $param) = @_[KERNEL, HEAP, ARG0]; print "State [call]\n"; async { } -> detach; return [ ]; } # ==================================================================== +========== __END__
CLIENT IMPLEMENTATION
# ==================================================================== +========== # CLIENT IMPLEMENTATION # exec: perl cln.pl # ==================================================================== +========== #!/usr/bin/perl -w # ==================================================================== +========== use strict; use POE qw( Session ); use POE::Component::IKC::Client; use POE::Component::IKC::Responder; # ==================================================================== +========== my $ip = '127.0.0.1'; my $port = '32032'; my $myName = $$; # ==================================================================== +========== create_ikc_client( ip => $ip, port => $port, name => $myName, subscribe => [ "poe://ThreadTest/TT" ], ); POE::Session -> new ( _start => \&start, remoteSubscribe => \&remoteSubscribe, runTestDone => \&runTestDone, ); $poe_kernel -> run; # === IKC STATES ===================================================== +========== sub start { my ($self, $kernel, $heap) = @_[ OBJECT, KERNEL, HEAP ]; print "State [start]\n"; create_ikc_responder(); $kernel -> alias_set( 'test' ); $kernel -> post( 'IKC', 'publish', 'test', [ qw( runTestDone ) ] ); $kernel -> post( 'IKC', 'monitor', 'ThreadTest', { subscribe => 'remoteSubscribe', } ); } # ==================================================================== +========== sub remoteSubscribe { my ($kernel, $heap, $name, $real_name, $what) = @_[ KERNEL, HEAP, +ARG0, ARG1, ARG4 ]; print "State [remoteSubscribe]\n"; return unless $real_name eq 'ThreadTest'; $kernel -> alias_set( 'test' ); $kernel -> post( 'IKC', 'call', "poe://ThreadTest/TT/call", [ $kernel -> ID ], 'poe:runTestDone' ); } # ==================================================================== +========== sub runTestDone { my ($kernel, $heap, $rData, $session) = @_[ KERNEL, HEAP, ARG0, SE +SSION ]; print "State [runTestDone]\n"; $kernel -> call( 'IKC', 'retract', 'test' ); $kernel -> alias_remove( 'test' ); $kernel -> post( IKC => 'shutdown' ); $kernel -> yield( 'shutdown' ); } # ==================================================================== +========== __END__

In reply to Re^8: POE and Win32::Process control by m-rau
in thread POE and Win32::Process control by m-rau

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.