tasks revision 9c3531d72aeaad6c5f01efe6a1c82023e1379e4d
0N/ACopyright (C) 1999, 2000 Internet Software Consortium.
0N/ASee COPYRIGHT in the source root or http://www.isc.org/copyright for terms.
0N/A
0N/A$Id: tasks,v 1.4 2000/06/22 21:53:59 tale Exp $
0N/A
0N/AChanges I made last week to the task code simplified the task shutdown
0N/Aand termination model. Here's how things now work:
0N/A
0N/AWhen a task is shutdown:
0N/A
0N/A Any "on shutdown" events for the task are posted
0N/A
0N/A The "shutting down" attribute of the task is set
0N/A
0N/A Any attempts to add shutdown events with isc_task_onshutdown()
0N/A will fail, since the task is already shutting down
0N/A
Task shutdown can be initiated explicity, via a call to isc_task_shutdown(),
or implicitly, when the following conditions occur:
The "shutting down" attribute of the task is not set
The task has no references
The task has an empty event queue
Task termination occurs when:
The "shutting down" attribute of the task is set
The task has no references
The task has an empty event queue
Notes from the task/event discussion led by Bob Halley on 13 March 2000:
A task is an event queue.
(task) --V
(event)-->(event)-->(event)
(runnable queue)--V
(task)-->(task)-->(task)
Normally only one task manager in an application.
Task becomes runnable if it has a non-empty event queue.
One or more worker threads run tasks.
Event routines should be relatively short.
Only one runnable queue that all workers share.
Events for a task are always posted serially. Multiple worker threads
will not be working on multiple events for one task at the same time.
isc_event_send, posting an event, can't fail. It just adds an event
to the task queue.
Event action (callback) rules:
* no locks held on your behald when entering a callback.
* not allowed to block, except when aquiring a lock.
* not allowed to hold a lock when exiting the callback.
TIMERS?
OMAPI -- need taskmgr to omapi_lib_init
-- one task per client connection