My initial testing with 10 concurrent threads has shown some crashes with
memory corruption, so there are some bugs lurking in the code. I also think
the tests need some tweaking to account for the possibility of running
multiple copies in parallel. For example, the 'timer' tests create a timer
with the kev.ident field set to 1. This would need to be changed so that the
kev.ident would be set to ctx->iteration which is unique to each thread.
Cheers,
- Mark
P.S. Here is an example of kqtest crashing when multiple threads are used.
$ gdb ./kqtest
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/mheily/proj/libkqueue/trunk/test/kqtest...done.
(gdb) r -c 10 -n 10 socket
Starting program: /home/mheily/proj/libkqueue/trunk/test/kqtest -c 10 -n 10
socket
[Thread debugging using libthread_db enabled]
enabled test: socket
Running 10 iterations using 10 worker threads
1: test_peer_close_detection()
2: test_kqueue()
3: test_ev_receipt()
[New Thread 0x7ffff744a700 (LWP 4197)]
4: test_kevent_socket_add()
[New Thread 0x7ffff6c49700 (LWP 4198)]
5: test_kevent_socket_del()
6: test_kevent_socket_add_without_ev_add()
7: test_kevent_socket_get()
8: test_kevent_socket_add()
9: test_kevent_socket_disable_and_enable()
[New Thread 0x7ffff6448700 (LWP 4199)]
10: test_kevent_socket_del()
11: test_kevent_socket_add_without_ev_add()
[New Thread 0x7ffff5c47700 (LWP 4200)]
12: test_kevent_socket_oneshot()
13: test_kevent_socket_get()
14: test_kevent_socket_add()
[New Thread 0x7fffe7fff700 (LWP 4201)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff744a700 (LWP 4197)]
0x00007ffff7bd7084 in linux_kevent_copyout (kq=0x60d0e0, nready=1,
eventlist=0x7ffff7446ce0, nevents=1) at src/linux/platform.c:162
162 rv = filt->kf_copyout(eventlist, kn, ev);
(gdb)