[svn-commits] fjoe: freebsd/trunk r8338 - /freebsd/trunk/freebsd/dahdi/bsd-compat.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 15 14:15:46 CDT 2010


Author: fjoe
Date: Mon Mar 15 14:15:43 2010
New Revision: 8338

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8338
Log:
- Workqueue KPI:
        - remove flush_scheduled_work() and flush_workqueue() -- can not be implemented
        in terms of FreeBSD KPI easily
        - implement flush_work() that can be used as a replacement for flush_scheduled_work()
        - "hide" work_run()
        - use PI_REALTIME priority
- Tasklet KPI: use PI_REALTIME priority

Modified:
    freebsd/trunk/freebsd/dahdi/bsd-compat.c

Modified: freebsd/trunk/freebsd/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/bsd-compat.c?view=diff&rev=8338&r1=8337&r2=8338
==============================================================================
--- freebsd/trunk/freebsd/dahdi/bsd-compat.c (original)
+++ freebsd/trunk/freebsd/dahdi/bsd-compat.c Mon Mar 15 14:15:43 2010
@@ -55,7 +55,7 @@
 void
 tasklet_init(struct tasklet_struct *t, void (*func)(unsigned long), unsigned long data)
 {
-	TASK_INIT(&t->task, 0, tasklet_run, t);
+	TASK_INIT(&t->task, PI_REALTIME, tasklet_run, t);
 	t->func = func;
 	t->data = data;
 	t->disable_count = 0;
@@ -65,6 +65,7 @@
 tasklet_hi_schedule(struct tasklet_struct *t)
 {
 	taskqueue_enqueue(taskqueue_fast, &t->task);
+//	wakeup_one(taskqueue_fast);
 }
 
 void
@@ -231,7 +232,7 @@
  * Workqueue API
  */
 void
-work_run(void *context, int pending)
+_work_run(void *context, int pending)
 {
 	struct work_struct *work = (struct work_struct *) context;
 	work->func(work);
@@ -240,19 +241,21 @@
 void
 schedule_work(struct work_struct *work)
 {
+	work->tq = taskqueue_fast;
 	taskqueue_enqueue(taskqueue_fast, &work->task);
+//	wakeup_one(taskqueue_fast);
 }
 
 void
 cancel_work_sync(struct work_struct *work)
 {
-	taskqueue_drain(taskqueue_fast, &work->task);
-}
-
-void
-flush_scheduled_work(void)
-{
-	taskqueue_run(taskqueue_fast);
+	taskqueue_drain(work->tq, &work->task);
+}
+
+void
+flush_work(struct work_struct *work)
+{
+	taskqueue_drain(work->tq, &work->task);
 }
 
 struct workqueue_struct *
@@ -271,7 +274,7 @@
 		return NULL;
 	}
 
-	res = taskqueue_start_threads(&wq->tq, 1, PI_NET, "%s taskq", name);
+	res = taskqueue_start_threads(&wq->tq, 1, PI_REALTIME, "%s taskq", name);
 	if (res) {
 		destroy_workqueue(wq);
 		return NULL;
@@ -290,13 +293,9 @@
 void
 queue_work(struct workqueue_struct *wq, struct work_struct *work)
 {
+	work->tq = wq->tq;
 	taskqueue_enqueue(wq->tq, &work->task);
-}
-
-void
-flush_workqueue(struct workqueue_struct *wq)
-{
-	taskqueue_run(wq->tq);
+//	wakeup_one(wq->tq);
 }
 
 /*




More information about the svn-commits mailing list