Event objects
Reported by Tony Arcieri | May 6th, 2008 @ 08:33 PM | in 1.0 preview
Multiplexing different types of events on Channels is presently pretty difficult, to the point that IO#select cannot be implemented.
Evan threw out the idea of event objects. These could hopefully store any data resulting from I/O completions, the source of the I/O event, or completely non-I/O related things as not all events are I/O related, such as timeout events.
Event objects could abstract interaction with scheduler directly, e.g.:
te = TimeoutEvent.perform chan, 5.0, value
re = ReadEvent.perform chan, io, 4096, value
(where value is an optional user-specified parameter)
when the event occurs, a corresponding Event object is written to the channel, which would include the event type through the nature of its class, and also provide accessors for the event source, any data that may have resulted from the event (e.g. data read from an IO object), and the user value, if it was specified.
This would make for easy case-based processing of IO events, e.g.:
ev = chan.receive
case ev
when ReadEvent then read_handler(ev)
when WriteEvent then write_handler(ev)
when TimeoutEvent then timeout_handler(ev)
...
end
Comments and changes to this ticket
-
Ryan Davis June 23rd, 2008 @ 04:28 PM
- → Assigned user changed from to Evan Phoenix
I want to assign this to mentalguy... but he isn't in here. is there someone else? suggestions?
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
