Commit Graph

18 Commits

Author SHA1 Message Date
Michael Chapman
580ca05de3 Avoid double-decrement of level->todo
If a job's dispatch function deletes the job, we may end up decrementing
the job queue's todo count twice. Verify that the job is on the queue
before decrementing.
2013-08-20 09:30:16 +10:00
Takeshi MIZUTA
96e504f305 Unify the list processing with qb_list function 2013-01-09 02:04:20 +09:00
Angus Salkeld
1d857f5b51 LOOP: allow stop() and run() to be called with NULL loop instance.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-20 14:46:43 +11:00
Angus Salkeld
1e4b33c9cf LOOP: make it possible to pass in NULL as the default loop instance
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-10 14:47:49 +11:00
Angus Salkeld
346e4d892a LOOP: handle errors from the poll function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 10:16:00 +11:00
Angus Salkeld
48e7cff259 LOOP: fix the todo calculations.
The todo system was sucky as it was calculated in different
places in the mainloop and at each level. This was exposed by
calls to qb_loop_level_item_del() which decremented the level->todo
but not the mainloop one. So now we re-calculate it each time.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 09:41:00 +11:00
Angus Salkeld
f869f93deb LOOP: prevent jobs from consuming too much cpu.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 09:41:00 +11:00
Angus Salkeld
e235412497 TESTS: add tests for signal handlers
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-18 22:30:35 +11:00
Angus Salkeld
98493d9ae8 Change Lindent options to break the procedure type.
so change:
int foo(void)

to

int
foo(void)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 14:19:14 +10:00
Angus Salkeld
da5ea1345e Remove all the C++ comments
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-26 10:39:36 +10:00
Jim Meyering
4020c4cea8 avoid NULL dereference after failed malloc
* lib/util.c (qb_thread_lock_create): Handle failed malloc.
* lib/ipc_posix_mq.c (qb_ipc_pmq_sendv): Likewise.
* lib/loop_job.c (qb_loop_job_add): Likewise.
* lib/loop.c (qb_loop_create): Likewise.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-17 21:32:29 +10:00
Angus Salkeld
6c6486204b LOOP: add per-level todo counters
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:04 +11:00
Angus Salkeld
e7d2dd9646 LOOP: add signal support to main loop
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-09 11:51:22 +11:00
Angus Salkeld
fa57927089 LOOP: prevent high cpu utilization on no load.
We we passing "0" timeout into poll().

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-05 09:32:26 +11:00
Angus Salkeld
dc08661297 LOOP: add support for timerfd
If available use timerfd_create() as it is
much more accurate than tlist.h

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-01 10:14:08 +11:00
Angus Salkeld
970a4bc6d5 LOOP: add qb_loop_destroy()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-30 20:51:36 +11:00
Angus Salkeld
e211caab96 LOOP: fix job poll and simplify main loop
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-29 22:26:46 +11:00
Angus Salkeld
08e5a9004d Add a priority based main loop.
This is to try and get a better balance in the amount
of processing between IPC and totem in corosync.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00