Commit Graph

19 Commits

Author SHA1 Message Date
Chrissie Caulfield
a60ca50b67
Fix pthread returns (#444)
pthread calls do not set errno, they return the error directly
2021-08-11 07:55:42 +01:00
Jan Friesse
48fff5eb58
Implement heap based timer list (#439)
* tlist: Add heap based implementation of timer list

Previous timer was sorted list implementation of priority queue
and very slow when number of timers increased. This is mostly
not a problem because usually only few timers are used.
But for application where bigger number of timers are needed
it may become problem.

Solution is to use binary heap based priority queue which is much
faster.

API is unchanged, just timerlist_destroy is added which should be called
to free heap array. This function also destroys mutex (omitted when
mutex was added).

* tests: Fix check loop mt test

test_th was accesed both by main thread and loop_timer thread resulting in
failure. Fix is to access test_tht in loop_timer thread.

Speed test is adding only 10000 items so it is reasonable
fast even with sorted linked list implementation.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2021-03-18 07:27:25 +00:00
Chrissie Caulfield
d6e2bd1d6b
timers: Add some locking (#436)
Fix several locking issues reported by helgrind
2021-02-08 10:57:42 +00:00
Chrissie Caulfield
bdc716036a
Some bugs spotted by coverity (#399) 2020-05-28 07:30:26 +01:00
Takeshi MIZUTA
4d1a98ad76 Unify to QB_TRUE/QB_FALSE a boolean value 2013-01-11 02:01:06 +09:00
Takeshi MIZUTA
96e504f305 Unify the list processing with qb_list function 2013-01-09 02:04:20 +09:00
Angus Salkeld
916440d08d Remove HZ and use sysconf instead.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 21:38:38 +10:00
Angus Salkeld
324580f5c2 LOOP: remove tlist absolute timer
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-01-05 09:21:15 +11:00
Angus Salkeld
f7f6c89591 TLIST: use qb_util_nano_monotonic_hz() instead of HZ
also add a test for under running.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 15:15:31 +11:00
Angus Salkeld
d4ad56b8b7 TIME: move tlist_nano_ functions into util
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:36:13 +11:00
Angus Salkeld
9d8d6bfdce LINT: get the lint target working.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 22:36:08 +11:00
Angus Salkeld
9c0fa42f17 UTIL: add qb_timespec_add_ms()
add X milli seconds to a timespec.
add time defines to qbdefs.h

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
d27e50c58a Define new return status policy
Good >= 0 (0 = good, or positive value)
Bad < 0 (-errno)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-06 16:49:15 +10:00
Angus Salkeld
41c06ef6e6 int -> int32_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:55:09 +10:00
Angus Salkeld
cdb9d32de4 unsigned long long -> uint64_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:28:56 +10:00
Angus Salkeld
0a23eb2be1 Format all files with Lindent
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-10 21:42:08 +10:00
Angus Salkeld
caecbe6542 Re-license to LGPL 2.1
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 06:11:59 +10:00
Angus Salkeld
b503a98acf Added qb_ prefix onto public functions/types.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:28:22 +11:00
Angus Salkeld
81facf8267 Add poll, list & tlist
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-11 15:54:03 +11:00