diff options
author | Andy Grover <agrover@redhat.com> | 2014-11-03 14:44:05 -0800 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2015-01-12 14:34:28 -0600 |
commit | 6385e2d41b99e4d527ddbeff558e22490527c4b5 (patch) | |
tree | 91411ef668866c011dfcf507e4ac0297dc2fd2ca /include | |
parent | 9981b0602881eaefe8c65fe9f82d48bb15315768 (diff) | |
download | open-iscsi-6385e2d41b99e4d527ddbeff558e22490527c4b5.tar.gz |
Make running actors event-driven
Instead of waking up frequently to check if actors need to run, set an
alarm for the first timeout and use a signalfd to get us out of poll() when
the alarm expires and SIGALRM is sent.
alarm(2) only has second granularity but we are using delayed actors for
multi-second timeout handling so this is ok. All callsites were multiplying
by 1000 for wait-in-msec, so just change actor_timer() callsites to pass
timeout in seconds.
Fold actor_check() into actor_poll().
Remove actor_timer_mod, not used.
Rename actor_list to ready_list for clarity.
Remove poll_list, no longer needed.
Remove ACTOR_POLL_WAITING state, no longer needed.
Add some more helpful macros to list.h.
Based on earlier work by Chris Leech.
Signed-off-by: Andy Grover <agrover@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/list.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/list.h b/include/list.h index cccc3c3..94ad99b 100644 --- a/include/list.h +++ b/include/list.h @@ -38,6 +38,12 @@ static inline int list_empty(const struct list_head *head) #define list_entry(ptr, type, member) \ list_container_of(ptr, type, member) +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +#define list_first_entry_or_null(ptr, type, member) \ + (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) + #define list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) |