Skip to content

Commit

Permalink
add task_pending
Browse files Browse the repository at this point in the history
jsg@ wants this for drm, and i've had a version of it in diffs sine
2016, but obviously havent needed to use it just yet.

task_pending is modelled on timeout_pending, and tells you if the
task is on a list waiting to execute.

ok jsg@
  • Loading branch information
dlg committed Dec 16, 2018
1 parent fc1a500 commit ff4a31d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions sys/kern/kern_task.c
@@ -1,4 +1,4 @@
/* $OpenBSD: kern_task.c,v 1.22 2017/12/14 00:45:16 dlg Exp $ */
/* $OpenBSD: kern_task.c,v 1.23 2018/12/16 03:36:02 dlg Exp $ */

/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
Expand All @@ -24,8 +24,6 @@
#include <sys/task.h>
#include <sys/proc.h>

#define TASK_ONQUEUE 1

struct taskq {
enum {
TQ_S_CREATED,
Expand Down
4 changes: 1 addition & 3 deletions sys/net/ifq.c
@@ -1,4 +1,4 @@
/* $OpenBSD: ifq.c,v 1.24 2018/12/11 01:36:42 dlg Exp $ */
/* $OpenBSD: ifq.c,v 1.25 2018/12/16 03:36:02 dlg Exp $ */

/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
Expand Down Expand Up @@ -71,8 +71,6 @@ void ifq_start_task(void *);
void ifq_restart_task(void *);
void ifq_barrier_task(void *);

#define TASK_ONQUEUE 0x1

void
ifq_serialize(struct ifqueue *ifq, struct task *t)
{
Expand Down
6 changes: 5 additions & 1 deletion sys/sys/task.h
@@ -1,4 +1,4 @@
/* $OpenBSD: task.h,v 1.12 2017/11/13 23:52:49 dlg Exp $ */
/* $OpenBSD: task.h,v 1.13 2018/12/16 03:36:02 dlg Exp $ */

/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
Expand Down Expand Up @@ -30,6 +30,8 @@ struct task {
unsigned int t_flags;
};

#define TASK_ONQUEUE 1

TAILQ_HEAD(task_list, task);

#define TASKQ_MPSAFE (1 << 0)
Expand All @@ -49,6 +51,8 @@ void task_set(struct task *, void (*)(void *), void *);
int task_add(struct taskq *, struct task *);
int task_del(struct taskq *, struct task *);

#define task_pending(_t) ((_t)->t_flags & TASK_ONQUEUE)

#endif /* _KERNEL */

#endif /* _SYS_TASK_H_ */

0 comments on commit ff4a31d

Please sign in to comment.