eventfd
eventfd?
eventfd
fd->eventfd
eventfd-post
eventfd-wait
eventfd-fd
7.7

eventfd

Jan Dvořák <mordae@anilinux.org>

Linux eventfd interface for Racket.

 (require eventfd) package: eventfd

Interface that allows manipulation of Linux eventfd descriptors in a way similar to Racket’s semaphores.

procedure

(eventfd? value)  boolean?

  value : any/c
Predicate identifying an event descriptor structure. These event descriptors also act as a synchronizable event that produces same results as eventfd-wait would.

procedure

(eventfd initial-value    
  [#:semaphore? semaphore?])  eventfd?
  initial-value : exact-nonnegative-integer?
  semaphore? : boolean? = #f
Create completely new event descriptor. Remember that these count towards process file descriptor count.

procedure

(fd->eventfd fd)  eventfd?

  fd : exact-nonnegative-integer?
Create an eventfd? structure for an existing descriptor. It is undefined what happens when you pass it something that is not a valid event descriptor.

procedure

(eventfd-post efd [value])  void?

  efd : eventfd?
  value : exact-nonnegative-integer? = 1
Post given value to the semaphore.

procedure

(eventfd-wait efd)  exact-nonnegative-integer?

  efd : eventfd?
Wait until the semaphore represented by the descriptor becomes higher than zero and then return either it’s value, resetting it back to zero (when #:semaphore? set to #f) or return just 1, decrementing the semaphore.

procedure

(eventfd-fd efd)  exact-nonnegative-integer?

  efd : eventfd?
Return event descriptor as an integer.