NAME

Linux::FD::Event - Event filehandles

VERSION

Version 0.002

SYNOPSIS

 use Linux::FD::Event;
 
 my $foo = Linux::FD::Event->new(42);
 if (fork) {
	 say $foo->get while sleep 1
 }
 else {
     $foo->add($_) while <>;
 }

METHODS

new($initial_value)

This creates an eventfd object that can be used as an event wait/notify mechanism by userspace applications, and by the kernel to notify userspace applications of events. The object contains an unsigned 64-bit integer counter that is maintained by the kernel. This counter is initialized with the value specified in the argument $initial_value. The handle will be non-blocking by default.

get()

If the eventfd counter has a non-zero value, then a get returns 8 bytes containing that value, and the counter's value is reset to zero. If the counter is zero at the time of the get, then the call either blocks until the counter becomes non-zero, or fails with the error EAGAIN if the file handle has been made non-blocking.

add($value)

A add call adds the 8-byte integer value $value to the counter. The maximum value that may be stored in the counter is the largest unsigned 64-bit value minus 1 (i.e., 0xfffffffffffffffe). If the addition would cause the counter's value to exceed the maximum, then the add either blocks until a get is performed on the file descriptor, or fails with the error EAGAIN if the file descriptor has been made non- blocking. A add will fail with the error EINVAL if an attempt is made to write the value 0xffffffffffffffff.

AUTHOR

Leon Timmermans, <leont at cpan.org>

BUGS

Please report any bugs or feature requests to bug-linux-fd at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Linux-FD. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Linux::FD::Event

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2010 Leon Timmermans.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.