generalpenguin89/tpool — Issue #4: Give user some control over scheduling in tpool_submit()
Author: generalpenguin89
Created: 2011-12-28 20:38:53+00:00
State: open

I envision the following three scenarios:

1. default case: This is the way that it is right now. A new thread would be spawned for the task if there are more threads available; otherwise, the task would be queued.
2. queued mode (e.g., ```task->flags & TPOOL_TASK_QUEUED```): The task would be always queued unless there are no threads currently running in the pool, in which case a thread would be spawned for the task.
3. immediate exclusive mode (e.g., ```task->flags & TPOOL_TASK_IMMEDIATE```): A new thread would be spawned for the task if there are more threads available; otherwise, ```tpool_submit()``` would return ```EBUSY```.

Flag names aren't set in stone yet. If the two constants that I used above are used, then ```TPOOL_TASK_QUEUED``` and ```TPOOL_TASK_IMMEDIATE``` will be mutually exclusive (if used together, ```tpool_submit``` would return ```EINVAL```).