1/*
2 * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/librt/sigev_thread.c 156383 2006-03-07 08:28:07Z davidxu $
27 *
28 */
29
30#include <sys/types.h>
31#include <machine/atomic.h>
32
33#include "namespace.h"
34#include <err.h>
--- 334 unchanged lines hidden (view full) ---
369 int ret;
370
371 tn = arg;
372 thr_self(&tn->tn_lwpid);
373 __sigev_list_lock();
374 _pthread_cond_broadcast(&tn->tn_cv);
375 __sigev_list_unlock();
376
377 /*
378 * Service thread should not be killed by callback, if user
379 * attempts to do so, the thread will be restarted.
380 */
381 sigemptyset(&set);
382 sigaddset(&set, SIGSERVICE);
383 for (;;) {
384 ret = sigwaitinfo(&set, &si);
385
386 __sigev_list_lock();
387 if (tn->tn_refcount == 0) {
388 LIST_REMOVE(tn, tn_link);
--- 78 unchanged lines hidden ---
2 * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/librt/sigev_thread.c 156383 2006-03-07 08:28:07Z davidxu $
27 *
28 */
29
30#include <sys/types.h>
31#include <machine/atomic.h>
32
33#include "namespace.h"
34#include <err.h>
--- 334 unchanged lines hidden (view full) ---
369 int ret;
370
371 tn = arg;
372 thr_self(&tn->tn_lwpid);
373 __sigev_list_lock();
374 _pthread_cond_broadcast(&tn->tn_cv);
375 __sigev_list_unlock();
376
377 /*
378 * Service thread should not be killed by callback, if user
379 * attempts to do so, the thread will be restarted.
380 */
381 sigemptyset(&set);
382 sigaddset(&set, SIGSERVICE);
383 for (;;) {
384 ret = sigwaitinfo(&set, &si);
385
386 __sigev_list_lock();
387 if (tn->tn_refcount == 0) {
388 LIST_REMOVE(tn, tn_link);
--- 78 unchanged lines hidden ---