diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-03-04 00:18:19 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-03-04 00:18:19 +0000 |
commit | 8e36ba772a0d4c7556d1b618bc0485c97cae37a7 (patch) | |
tree | 17f6e8e0534f23d8bcdda95b7377ff0aca417da9 /lib/librt/timer.c | |
parent | 2399d185fc6ba76a6630ecae4436a11772a3973e (diff) | |
download | FreeBSD-src-8e36ba772a0d4c7556d1b618bc0485c97cae37a7.zip FreeBSD-src-8e36ba772a0d4c7556d1b618bc0485c97cae37a7.tar.gz |
Use a thread pool to process notification if sigev_notify_attributes
is default and caller does not require dedicated thread. timer needs
a dedicated thread to maintain overrun count correctly in notification
context. mqueue and aio can use thread pool to do notification
concurrently, the thread pool has lifecycle control, some threads will
exit if they have idled for a while.
Diffstat (limited to 'lib/librt/timer.c')
-rw-r--r-- | lib/librt/timer.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/librt/timer.c b/lib/librt/timer.c index c5d0671..3db5f5b 100644 --- a/lib/librt/timer.c +++ b/lib/librt/timer.c @@ -66,16 +66,16 @@ __weak_reference(__timer_settime, _timer_settime); __weak_reference(__timer_getoverrun, timer_getoverrun); __weak_reference(__timer_getoverrun, _timer_getoverrun); -typedef void (*timer_func)(union sigval val, int timerid, int overrun); +typedef void (*timer_func)(union sigval val, int overrun); static void -timer_dispatch(struct sigev_node *sn, siginfo_t *si) +timer_dispatch(struct sigev_node *sn) { timer_func f = sn->sn_func; /* I want to avoid expired notification. */ - if (si->si_value.sival_int == sn->sn_gen) - f(sn->sn_value, si->si_timerid, si->si_overrun); + if (sn->sn_info.si_value.sival_int == sn->sn_gen) + f(sn->sn_value, sn->sn_info.si_overrun); } int @@ -108,7 +108,7 @@ __timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid) return (-1); } - sn = __sigev_alloc(SI_TIMER, evp); + sn = __sigev_alloc(SI_TIMER, evp, NULL, 0); if (sn == NULL) { errno = EAGAIN; return (-1); |