svn commit: r226542 - in user/adrian/if_ath_tx/sys: kern sys

Adrian Chadd adrian at FreeBSD.org
Wed Oct 19 12:16:20 UTC 2011


Author: adrian
Date: Wed Oct 19 12:16:19 2011
New Revision: 226542
URL: http://svn.freebsd.org/changeset/base/226542

Log:
  Begin fleshing out a way to wait for all pending taskqueue entries to complete.
  The current API only lets you wait for a given taskqueue task, rather than all
  of them.
  
  This isn't (yet) tested.

Modified:
  user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c
  user/adrian/if_ath_tx/sys/sys/taskqueue.h

Modified: user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c
==============================================================================
--- user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c	Wed Oct 19 12:15:16 2011	(r226541)
+++ user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c	Wed Oct 19 12:16:19 2011	(r226542)
@@ -397,6 +397,22 @@ taskqueue_drain(struct taskqueue *queue,
 	TQ_UNLOCK(queue);
 }
 
+/*
+ * XXX this is currently completely and utterly undocumented.
+ */
+void
+taskqueue_drain_all(struct taskqueue *queue)
+{
+
+	if (!queue->tq_spin)
+		WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
+
+	TQ_LOCK(queue);
+	while (! STAILQ_EMPTY(&queue->tq_queue))
+		TQ_SLEEP(queue, queue, &queue->tq_mutex, PWAIT, "-", 0);
+	TQ_UNLOCK(queue);
+}
+
 void
 taskqueue_drain_timeout(struct taskqueue *queue,
     struct timeout_task *timeout_task)

Modified: user/adrian/if_ath_tx/sys/sys/taskqueue.h
==============================================================================
--- user/adrian/if_ath_tx/sys/sys/taskqueue.h	Wed Oct 19 12:15:16 2011	(r226541)
+++ user/adrian/if_ath_tx/sys/sys/taskqueue.h	Wed Oct 19 12:16:19 2011	(r226542)
@@ -69,6 +69,7 @@ int	taskqueue_cancel(struct taskqueue *q
 int	taskqueue_cancel_timeout(struct taskqueue *queue,
 	    struct timeout_task *timeout_task, u_int *pendp);
 void	taskqueue_drain(struct taskqueue *queue, struct task *task);
+void	taskqueue_drain_all(struct taskqueue *queue);
 void	taskqueue_drain_timeout(struct taskqueue *queue,
 	    struct timeout_task *timeout_task);
 void	taskqueue_free(struct taskqueue *queue);


More information about the svn-src-user mailing list