diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-02-24 18:21:33 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-03-21 16:47:28 +0000 |
commit | 1de342b8a4cf13b295805855bfaa341bcd86277e (patch) | |
tree | 2b550a0d60532446dad50ee3ecc703a90bb6d780 /distbuild/eventsrc.py | |
parent | f4b503b036f76c23c4f2cb99ca6596823b323035 (diff) | |
download | morph-1de342b8a4cf13b295805855bfaa341bcd86277e.tar.gz |
Add the distbuild libs
Diffstat (limited to 'distbuild/eventsrc.py')
-rw-r--r-- | distbuild/eventsrc.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/distbuild/eventsrc.py b/distbuild/eventsrc.py new file mode 100644 index 00000000..11bb16e8 --- /dev/null +++ b/distbuild/eventsrc.py @@ -0,0 +1,48 @@ +# mainloop/eventsrc.py -- interface for event sources +# +# Copyright 2012 Codethink Limited. +# All rights reserved. + + +class EventSource(object): + + '''A source of events for state machines. + + This is a base class. + + An event source watches one file descriptor, and returns events + related to it. The events may vary depending on the file descriptor. + The actual watching is done using select.select. + + ''' + + def get_select_params(self): + '''Return parameters to use for select for this event source. + + Three lists of file descriptors, and a timeout are returned. + The three lists and the timeout are used as arguments to the + select.select function, though they may be manipulated and + combined with return values from other event sources. + + ''' + + return [], [], [], None + + def get_events(self, r, w, x): + '''Return events related to this file descriptor. + + The arguments are the return values of select.select. + + ''' + + return [] + + def is_finished(self): + '''Is this event source finished? + + It's finished if it won't ever return any new events. + + ''' + + return False + |