GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CORO::EV (3)

.ds Aq ’

NAME

Coro::EV - do events the coro-way, with EV

CONTENTS

SYNOPSIS



 use Coro;
 use Coro::EV;

 EV::READ & Coro::EV::timed_io_once $fh, EV::READ, 60
    or die "timeout\n";

 EV::run;



DESCRIPTION

This module does two things: First, it offers some utility functions that might be useful for threads (although Coro::AnyEvent offers more and more portable functions), and secondly, it integrates Coro into the EV main loop:

Before the process blocks (in EV::run) to wait for events, this module will schedule and run all ready (= runnable) threads of the same or higher priority. After that, it will cede once to a threads of lower priority, then continue in the event loop.

That means that threads with the same or higher priority as the threads running the main loop will inhibit event processing, while threads of lower priority will get the CPU, but cannot completeley inhibit event processing. Note that for that to work you actually have to run the EV event loop in some thread.

RUNNING WITH OR WITHOUT A MAINLOOP

In general, you should always run EV::run, either in your main program, or in a separate coroutine. If you don’t do that and all coroutines start waiting for some events, this module will run the event loop once, but this is very inefficient and will also not make it possible to run background threads.

To run the EV event loop in a separate thread, you can simply do this:



  async { EV::run };



FUNCTIONS

$revents = Coro::EV::timed_io_once $fileno_or_fh, $events[, $timeout] Blocks the coroutine until either the given event set has occured on the fd, or the timeout has been reached (if timeout is missing or undef then there will be no timeout). Returns the received flags.

Consider using Coro::AnyEvent::readable and Coro::AnyEvent::writable instead, they work with any AnyEvent-supported eventloop.

Coro::EV::timer_once $after Blocks the coroutine for at least $after seconds.

Consider using Coro::AnyEvent::sleep instead, which works with any AnyEvent-supported eventloop.

AUTHOR/SUPPORT/CONTACT



   Marc A. Lehmann <schmorp@schmorp.de>
   http://software.schmorp.de/pkg/Coro.html



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 EV (3) 2015-10-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.