subr_taskqueue.c (213813) | subr_taskqueue.c (215011) |
---|---|
1/*- 2 * Copyright (c) 2000 Doug Rabson 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Doug Rabson 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/subr_taskqueue.c 213813 2010-10-13 22:59:04Z mdf $"); | 28__FBSDID("$FreeBSD: head/sys/kern/subr_taskqueue.c 215011 2010-11-08 20:56:31Z mdf $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/interrupt.h> 34#include <sys/kernel.h> 35#include <sys/kthread.h> 36#include <sys/lock.h> --- 233 unchanged lines hidden (view full) --- 270 mtx_assert(&queue->tq_mutex, MA_OWNED); 271 TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { 272 if (tb->tb_running == task) 273 return (1); 274 } 275 return (0); 276} 277 | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/interrupt.h> 34#include <sys/kernel.h> 35#include <sys/kthread.h> 36#include <sys/lock.h> --- 233 unchanged lines hidden (view full) --- 270 mtx_assert(&queue->tq_mutex, MA_OWNED); 271 TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { 272 if (tb->tb_running == task) 273 return (1); 274 } 275 return (0); 276} 277 |
278int 279taskqueue_cancel(struct taskqueue *queue, struct task *task, u_int *pendp) 280{ 281 u_int pending; 282 int error; 283 284 TQ_LOCK(queue); 285 if ((pending = task->ta_pending) > 0) 286 STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); 287 task->ta_pending = 0; 288 error = task_is_running(queue, task) ? EBUSY : 0; 289 TQ_UNLOCK(queue); 290 291 if (pendp != NULL) 292 *pendp = pending; 293 return (error); 294} 295 |
|
278void 279taskqueue_drain(struct taskqueue *queue, struct task *task) 280{ 281 282 if (!queue->tq_spin) 283 WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); 284 285 TQ_LOCK(queue); --- 186 unchanged lines hidden --- | 296void 297taskqueue_drain(struct taskqueue *queue, struct task *task) 298{ 299 300 if (!queue->tq_spin) 301 WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); 302 303 TQ_LOCK(queue); --- 186 unchanged lines hidden --- |