10.9. File too/RunLoop

class too.RunLoop

inherits

State supers: State

variables

local static instance (id) current;

This thread's run loop.

methods


instance (id)
  current;

Return this thread's RunLoop, creating it if it does not yet exist.

instance too.RunLoop

variables

DescriptorSet read_set;

The read and write sets.

DescriptorSet write_set;

Heap timers;

The timers scheduled with us.

public mutable RunLoopDelegate delegate;

The delegate, if we have one.

boolean d_changed;

Iff TRUE, one of the descriptor sets was changed, indicating to the run method that it should update some of its local variables.

boolean t_changed;

Iff TRUE, the timers was changed.

methods


id (self)
  init;

Designated initializer.


void
  run;

Run this runloop. This method does not return.


void
  addDescriptorForRead Descriptor descriptor
              delegate DescriptorReadDelegate delegate;

Add the descriptor to this runloop, read events on which are to be handled by the delegate. This does not protect against adding the descriptor to only a single runloop.


void
  addDescriptorForWrite Descriptor descriptor
               delegate DescriptorWriteDelegate delegate;

Similar to addDescriptorForRead delegate, add the descriptor to this runloop, write events on which are to be handled by the delegate.


void
  removeReadDescriptor Descriptor descriptor;

Remove the descriptor from this runloop. No check is performed on whether the descriptor actually is registered for reading with this runloop.


void
  removeWriteDescriptor Descriptor descriptor;

Similar to removeReadDescriptor, but the descriptor is removed from the write set.


void
  add_timer Timer timer;

Add the timer to the current run loop.


void
  remove_timer Timer timer;

Remove the timer which is scheduled with this run loop.

class too.RunLoopDelegate

instance too.RunLoopDelegate

methods


deferred void
  runLoopWillSelect RunLoop loop;

Be notified that the RunLoop loop will do another select.

class tom.All (RunLoop)

This extension of All provides delayed performance.

instance tom.All (RunLoop)

methods


void
  perform selector sel
    after double seconds
     with dynamic arguments
pre
  seconds >= 0.0;

Perform the selector sel with the arguments after seconds delay. Even if seconds is 0, the invocation is not fired immediately; a timer is always set to have the RunLoop fire the invocation.