Coro-MP

 view release on metacpan or  search on metacpan

MP.pm  view on Meta::CPAN


=item port

This function is exactly the same as C<AnyEvent::MP::port> and creates new
ports. You can attach a thread to them by calling C<rcv_async> or you can
do a create and attach in one operation using C<port_async>.

=item peval

This function works exactly as C<AnyEvent::MP::psub> - you could use it to
run callbacks within a port context (good for monitoring), but you cannot
C<get> messages unless the callback executes within the thread attached to
the port.

Since creating a thread with port context requires somewhta annoying
syntax, there is a C<peval_async> function that handles that for you - note
that within such a thread, you still cannot C<get> messages.

=item spawn

This function is identical to C<AnyEvent::MP::spawn>. This means that

MP.pm  view on Meta::CPAN

      ? rcv_async $port, shift
      : AnyEvent::MP::rcv $port, undef;

   $port
}

=item rcv_async $port, $threadcb

This function creates and attaches a thread on a port. The thread is set
to execute C<$threadcb> and is put into the ready queue. The thread will
receive all messages not filtered away by tagged receive callbacks (as set
by C<AnyEvent::MP::rcv>) - it simply replaces the default callback of an
AnyEvent::MP port.

The special variable C<$SELF> will be set to C<$port> during thread
execution.

When C<$threadcb> returns or the thread is canceled, the return/cancel
values become the C<kil> reason.

It is not allowed to call C<rcv_async> more than once on a given port.

README  view on Meta::CPAN

        receive messages with Coro::MP is to use "get" or "get_cond".

    port
        This function is exactly the same as "AnyEvent::MP::port" and
        creates new ports. You can attach a thread to them by calling
        "rcv_async" or you can do a create and attach in one operation using
        "port_async".

    peval
        This function works exactly as "AnyEvent::MP::psub" - you could use
        it to run callbacks within a port context (good for monitoring), but
        you cannot "get" messages unless the callback executes within the
        thread attached to the port.

        Since creating a thread with port context requires somewhta annoying
        syntax, there is a "peval_async" function that handles that for you
        - note that within such a thread, you still cannot "get" messages.

    spawn
        This function is identical to "AnyEvent::MP::spawn". This means that
        it doesn't spawn a new thread as one would expect, but simply calls

README  view on Meta::CPAN


    $local_port = port_async { ... }
        Creates a new local port, and returns its ID. A new thread is
        created and attached to the port (see "rcv_async", below, for
        details).

    rcv_async $port, $threadcb
        This function creates and attaches a thread on a port. The thread is
        set to execute $threadcb and is put into the ready queue. The thread
        will receive all messages not filtered away by tagged receive
        callbacks (as set by "AnyEvent::MP::rcv") - it simply replaces the
        default callback of an AnyEvent::MP port.

        The special variable $SELF will be set to $port during thread
        execution.

        When $threadcb returns or the thread is canceled, the return/cancel
        values become the "kil" reason.

        It is not allowed to call "rcv_async" more than once on a given
        port.



( run in 1.045 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )