~romaia/kiwi/teste-ppa

« back to all changes in this revision

Viewing changes to kiwi/tasklet.py

  • Committer: Fabio Morbec
  • Date: 2007-11-06 16:21:26 UTC
  • Revision ID: git-v1:1c3cea2a032acee73e4a5be2bba4ed8a88f5aa7b
1.9.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
    """
205
205
    Return the last event that caused the current tasklet to regain control.
206
206
 
207
 
    @warning: this function should be called exactly once after each
 
207
    @note: this function should be called exactly once after each
208
208
    yield that includes a wait condition.
209
209
 
210
210
    """
217
217
def run(gen):
218
218
    """Start running a generator as a L{Tasklet}.
219
219
 
220
 
    @parameter gen: generator object that implements the tasklet body.
 
220
    @param gen: generator object that implements the tasklet body.
221
221
    @return: a new L{Tasklet} instance, already running.
222
222
 
223
223
    @note: this is strictly equivalent to calling C{Tasklet(gen)}.
249
249
        WaitCondition object must "rearm" itself (continue to monitor
250
250
        events), otherwise it should disarm.
251
251
 
252
 
        @parameter tasklet: the tasklet instance the wait condition is
 
252
        @param tasklet: the tasklet instance the wait condition is
253
253
          to be associated with.
254
 
        @attention: this method normally should not be called directly
 
254
        @note: this method normally should not be called directly
255
255
          by the programmer.
256
256
 
257
257
        '''
260
260
    def disarm(self):
261
261
        '''Stop the wait condition from receiving events.
262
262
 
263
 
        @attention: this method normally should not be called by the
 
263
        @note: this method normally should not be called by the
264
264
        programmer.'''
265
265
        raise NotImplementedError
266
266
 
323
323
    def __init__(self, filedes, condition=gobject.IO_IN,
324
324
                 priority=gobject.PRIORITY_DEFAULT):
325
325
        '''
 
326
        Create a new WaitForIO object.
 
327
 
326
328
        @param filedes: object to monitor for IO
327
329
        @type filedes: int file descriptor, or a
328
 
        gobject.IOChannel, or an object with a C{fileno()}
329
 
        method, such as socket or unix file.
 
330
            gobject.IOChannel, or an object with a C{fileno()}
 
331
            method, such as socket or unix file.
330
332
 
331
333
        @param condition: IO event mask
332
334
        @type condition: a set of C{gobject.IO_*} flags ORed together
587
589
    '''An object that waits for a process to end'''
588
590
    def __init__(self, pid):
589
591
        '''
590
 
        Creates an object that waits for a subprocess
 
592
        Creates an object that waits for a subprocess.
591
593
 
592
 
        @parameter pid: Process identifier
 
594
        @param pid: Process identifier
593
595
        @type pid: int
594
596
        '''
595
597
        WaitCondition.__init__(self)
629
631
 
630
632
    def __init__(self, name, dest=None, value=None, sender=None):
631
633
        '''
 
634
        Create a new Message object.
 
635
 
632
636
        @param name: name of message
633
637
        @type name: str
634
638
        @param dest: destination tasklet for this message
681
685
        '''Creates an object that waits for a set of messages to
682
686
        arrive.
683
687
 
684
 
        @warning: unlike other wait conditions, when a message
 
688
        @note: unlike other wait conditions, when a message
685
689
          is received, a L{Message} instance is returned by L{get_event()},
686
690
          not the L{WaitForMessages} instance.
687
691
        @param accept: message name or names to accept (receive) in
782
786
        Should be overridden in a subclass if no generator is passed
783
787
        into the constructor.
784
788
 
785
 
        @warning: do NOT call this method directly; it is meant to be called by
 
789
        @note: do NOT call this method directly; it is meant to be called by
786
790
        the tasklet framework.
787
791
        """
788
792
        raise NotImplementedError(
956
960
    def send_message(self, message):
957
961
        """Send a message to be received by the tasklet as an event.
958
962
 
959
 
        @warning: Don't call this from another tasklet, only from the
 
963
        @note: Don't call this from another tasklet, only from the
960
964
        main loop!  To send a message from another tasklet, yield a
961
965
        L{Message} with a correctly set 'dest' parameter.
962
966