Package ganeti :: Module daemon :: Class AsyncAwaker
[hide private]
[frames] | no frames]

Class AsyncAwaker

source code


A way to notify the asyncore loop that something is going on.

If an asyncore daemon is multithreaded when a thread tries to push some data to a socket, the main loop handling asynchronous requests might be sleeping waiting on a select(). To avoid this it can create an instance of the AsyncAwaker, which other threads can use to wake it up.

Instance Methods [hide private]
 
__init__(self, signal_fn=None)
Constructor for AsyncAwaker
source code
 
handle_read(self) source code
 
close(self) source code
 
signal(self)
Signal the asyncore main loop.
source code

Inherited from GanetiBaseAsyncoreDispatcher: handle_error, writable

Inherited from asyncore.dispatcher: __getattr__, __repr__, accept, add_channel, bind, connect, create_socket, del_channel, handle_accept, handle_close, handle_connect, handle_connect_event, handle_expt, handle_expt_event, handle_read_event, handle_write, handle_write_event, listen, log, log_info, readable, recv, send, set_reuse_addr, set_socket

Class Variables [hide private]

Inherited from asyncore.dispatcher: accepting, addr, closing, connected, debug, ignore_log_types

Method Details [hide private]

__init__(self, signal_fn=None)
(Constructor)

source code 

Constructor for AsyncAwaker

Parameters:
  • signal_fn (function) - function to call when awaken
Overrides: asyncore.dispatcher.__init__

handle_read(self)

source code 
Overrides: asyncore.dispatcher.handle_read

close(self)

source code 
Overrides: asyncore.dispatcher.close

signal(self)

source code 

Signal the asyncore main loop.

Any data we send here will be ignored, but it will cause the select() call to return.