+// SPDX-FileCopyrightText: 2010 Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+// SPDX-FileCopyrightText: 2017 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
/*
- * workqueue.c
- *
* Userspace RCU library - Userspace workqeues
- *
- * Copyright (c) 2010 Paul E. McKenney <paulmck@linux.vnet.ibm.com>
- * Copyright (c) 2017 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _LGPL_SOURCE
static void futex_wait(int32_t *futex)
{
- int ret;
-
/* Read condition before read futex */
cmm_smp_mb();
while (uatomic_read(futex) == -1) {
{
struct urcu_workqueue *workqueue;
int ret;
+ sigset_t newmask, oldmask;
workqueue = malloc(sizeof(*workqueue));
if (workqueue == NULL)
workqueue->cpu_affinity = cpu_affinity;
workqueue->loop_count = 0;
cmm_smp_mb(); /* Structure initialized before pointer is planted. */
+
+ ret = sigfillset(&newmask);
+ urcu_posix_assert(!ret);
+ ret = pthread_sigmask(SIG_BLOCK, &newmask, &oldmask);
+ urcu_posix_assert(!ret);
+
ret = pthread_create(&workqueue->tid, NULL, workqueue_thread, workqueue);
if (ret) {
urcu_die(ret);
}
+
+ ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
+ urcu_posix_assert(!ret);
+
return workqueue;
}
void urcu_workqueue_create_worker(struct urcu_workqueue *workqueue)
{
int ret;
+ sigset_t newmask, oldmask;
/* Clear workqueue state from parent. */
workqueue->flags &= ~URCU_WORKQUEUE_PAUSED;
workqueue->flags &= ~URCU_WORKQUEUE_PAUSE;
workqueue->tid = 0;
+
+ ret = sigfillset(&newmask);
+ urcu_posix_assert(!ret);
+ ret = pthread_sigmask(SIG_BLOCK, &newmask, &oldmask);
+ urcu_posix_assert(!ret);
+
ret = pthread_create(&workqueue->tid, NULL, workqueue_thread, workqueue);
if (ret) {
urcu_die(ret);
}
+
+ ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
+ urcu_posix_assert(!ret);
}