mirror of
https://github.com/darlinghq/darling-libkqueue.git
synced 2024-10-07 01:03:27 +00:00
fcc95e5a18
Improve the knote reference counting mechanism. New function knote_delete(). Rename 'flags' to 'kn_flags' in struct knote. Rename 'mtx' to 'kn_mtx' in struct knote. Rename 'kntree_ent' to 'kn_entries' in struct knote. Add a knote flag named 'KNFL_KNOTE_DELETED' to indicate that a knote has been deleted. With reference counting, this becomes necessary. git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@491 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
44 lines
1.7 KiB
Plaintext
44 lines
1.7 KiB
Plaintext
* There are very likely to be lock-related bugs stemming from when the
|
|
kevent_copyin() and kevent_copyout() functions stopped holding the
|
|
kqueue lock. It would be nice to have a lock testing mechanism to
|
|
check that the correct locks are held.. something like:
|
|
|
|
#define MTX_LOCKED 1
|
|
#define MTX_UNLOCKED 0
|
|
#if NDEBUG
|
|
#define LOCK_MONITOR(x) int x
|
|
#define lock_assert(x,y) assert((x) == (y))
|
|
#define lock_acquire(x,y) do { pthread_mutex_lock((x)); y = MTX_LOCKED } while (0)
|
|
#define lock_release(x,y) do { pthread_mutex_unlock((x)); y = MTX_UNLOCKED } while (0)
|
|
#else
|
|
#define LOCK_MONITOR(x) /**/
|
|
#define lock_assert(x,y) do {} while (0)
|
|
#define lock_acquire(x,y) do { pthread_mutex_lock((x)); } while (0)
|
|
#define lock_release(x,y) do { pthread_mutex_unlock((x)); } while (0)
|
|
#endif
|
|
|
|
struct foo {
|
|
LOCK_MONITOR(foo_lockstat);
|
|
}
|
|
...
|
|
|
|
lock_assert(&kn->kn_lockmon, MTX_LOCKED);
|
|
lock_assert(&kn->kn_lockmon, MTX_UNLOCKED);
|
|
|
|
* Add a counter that increments on each each kevent() call. When printing
|
|
debug information within kevent(), display the value of the counter.
|
|
This will be helpful when debugging a multithreaded program that may have
|
|
multiple kevent() calls executing in parallel.
|
|
|
|
* Add a dbg_printf() statement within kevent_wait() to report the value
|
|
of the timeout.
|
|
|
|
* Refactor kevent_copyin() to remove the goto statements.
|
|
|
|
* Fix the crasher w/ corruption in test/vnode.c
|
|
|
|
* Add the kevent64() syscall as implemented on MacOS X. This guarantees
|
|
that 64-bit values can be used in the 'udata' field on 32-bit platforms.
|
|
|
|
* Check other filters for the EV_DISPATCH bug that was fixed in r252.
|