Closed ghaskins closed 13 years ago
This patch uses libev inside the NIF framework to provide a mechanism for monitoring one or more file-descriptors for changes.
It introduces three more verbs to the procket namespace:
{ok, Handle} = procket:watcher_create(Fd, Flags, Cookie) procket:watcher_arm(Handle) procket:watcher_disarm(Handle)
The idea is that watcher_create takes an Fd, and a set of flags (0x1 for READ, 0x2 for WRITE, 0x3 for READ/WRITE), and an arbitrary term (Cookie).
When the FD becomes ready for either a READ or WRITE, it will fire a msg {procket_watcher, Flags, Cookie} back at the caller and disarm itself.
The user may subsequently re-arm the trigger with procket:watcher_arm() and disarm it with procket:watcher_disarm().
Signed-off-by: Gregory Haskins ghaskins@novell.com
This is just incredible, true {active, once} mode! Thanks so much!
This patch uses libev inside the NIF framework to provide a mechanism for monitoring one or more file-descriptors for changes.
It introduces three more verbs to the procket namespace:
{ok, Handle} = procket:watcher_create(Fd, Flags, Cookie) procket:watcher_arm(Handle) procket:watcher_disarm(Handle)
The idea is that watcher_create takes an Fd, and a set of flags (0x1 for READ, 0x2 for WRITE, 0x3 for READ/WRITE), and an arbitrary term (Cookie).
When the FD becomes ready for either a READ or WRITE, it will fire a msg {procket_watcher, Flags, Cookie} back at the caller and disarm itself.
The user may subsequently re-arm the trigger with procket:watcher_arm() and disarm it with procket:watcher_disarm().
Signed-off-by: Gregory Haskins ghaskins@novell.com