On Thursday 29 April 2010 01:59:58 Matthew Fleming wrote:
> struct task {
> - STAILQ_ENTRY(task) ta_link; /* link for queue */
> - u_short ta_pending; /* count times queued */
> - u_short ta_priority; /* Priority */
> - task_fn_t *ta_func; /* task handler */
> - void *ta_context; /* argument for handler */
> + STAILQ_ENTRY(task) ta_link; /* (q) link for queue */
> + u_char ta_flags; /* (q) state of this task */
> +#define TA_FLAGS_RUNNING 0x01
> + u_short ta_pending; /* (q) count times queued */
> + u_short ta_priority; /* (c) Priority */
> + task_fn_t *ta_func; /* (c) task handler */
> + void *ta_context; /* (c) argument for handler */
Hi,
I would rather implement TAILQ_ENTRY() here, and put some magic in the
"tqe_prev" field, hence the u_char you add, will be padded to a bigger size on
non-intel platforms anyway.
task->ta_pending = 0;
- queue->tq_running = task;
+ task->ta_entry.tqe_prev = (void *)1;
TQ_UNLOCK(queue);
task->ta_func(task->ta_context, pending);
TQ_LOCK(queue);
- queue->tq_running = NULL;
+ task->ta_entry.tqe_prev = (void *)0;
wakeup(task);
}
...
+ while (task->ta_entry != (void *)0)
--HPS
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[email protected]"