Index: kernel/generic/src/synch/workqueue.c
===================================================================
--- kernel/generic/src/synch/workqueue.c	(revision 045523247b162c88f46808e9415ee4bbc16ad5d7)
+++ kernel/generic/src/synch/workqueue.c	(revision 63e27efdf2fe6d3fa02bbb5ee1da00df5cc07e9d)
@@ -37,4 +37,5 @@
  */
 
+#include <assert.h>
 #include <synch/workqueue.h>
 #include <synch/spinlock.h>
@@ -189,5 +190,5 @@
 	if (workq) {
 		if (workq_init(workq, name)) {
-			ASSERT(!workq_corrupted(workq));
+			assert(!workq_corrupted(workq));
 			return workq;
 		}
@@ -202,5 +203,5 @@
 void workq_destroy(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	irq_spinlock_lock(&workq->lock, true);
@@ -214,5 +215,5 @@
 		workq_stop(workq);
 	} else {
-		ASSERT(0 == running_workers);
+		assert(0 == running_workers);
 	}
 	
@@ -264,5 +265,5 @@
 static bool add_worker(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 
 	thread_t *thread = thread_create(worker_thread, workq, TASK, 
@@ -273,5 +274,5 @@
 		
 		/* cur_worker_cnt proactively increased in signal_worker_logic() .*/
-		ASSERT(0 < workq->cur_worker_cnt);
+		assert(0 < workq->cur_worker_cnt);
 		--workq->cur_worker_cnt;
 		
@@ -312,5 +313,5 @@
 		
 		/* cur_worker_cnt proactively increased in signal_worker() .*/
-		ASSERT(0 < workq->cur_worker_cnt);
+		assert(0 < workq->cur_worker_cnt);
 		--workq->cur_worker_cnt;
 	}
@@ -334,5 +335,5 @@
 void workq_stop(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	interrupt_workers(workq);
@@ -346,5 +347,5 @@
 
 	/* workq_stop() may only be called once. */
-	ASSERT(!workq->stopping);
+	assert(!workq->stopping);
 	workq->stopping = true;
 	
@@ -358,5 +359,5 @@
 static void wait_for_workers(struct work_queue *workq)
 {
-	ASSERT(!PREEMPTION_DISABLED);
+	assert(!PREEMPTION_DISABLED);
 	
 	irq_spinlock_lock(&workq->lock, true);
@@ -375,5 +376,5 @@
 	}
 	
-	ASSERT(list_empty(&workq->workers));
+	assert(list_empty(&workq->workers));
 	
 	/* Wait for deferred add_worker_op(), signal_worker_op() to finish. */
@@ -473,5 +474,5 @@
 	work_func_t func, bool can_block)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	bool success = true;
@@ -521,17 +522,17 @@
 static size_t active_workers_now(struct work_queue *workq)
 {
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* Workers blocked are sleeping in the work function (ie not idle). */
-	ASSERT(workq->blocked_worker_cnt <= workq->cur_worker_cnt);
+	assert(workq->blocked_worker_cnt <= workq->cur_worker_cnt);
 	/* Idle workers are waiting for more work to arrive in condvar_wait. */
-	ASSERT(workq->idle_worker_cnt <= workq->cur_worker_cnt);
+	assert(workq->idle_worker_cnt <= workq->cur_worker_cnt);
 	
 	/* Idle + blocked workers == sleeping worker threads. */
 	size_t sleeping_workers = workq->blocked_worker_cnt + workq->idle_worker_cnt;
 	
-	ASSERT(sleeping_workers	<= workq->cur_worker_cnt);
+	assert(sleeping_workers	<= workq->cur_worker_cnt);
 	/* Workers pending activation are idle workers not yet given a time slice. */
-	ASSERT(workq->activate_pending <= workq->idle_worker_cnt);
+	assert(workq->activate_pending <= workq->idle_worker_cnt);
 	
 	/* 
@@ -550,5 +551,5 @@
 static size_t active_workers(struct work_queue *workq)
 {
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* 
@@ -573,10 +574,10 @@
 static void signal_worker_op(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 
 	condvar_signal(&workq->activate_worker);
 	
 	irq_spinlock_lock(&workq->lock, true);
-	ASSERT(0 < workq->pending_op_cnt);
+	assert(0 < workq->pending_op_cnt);
 	--workq->pending_op_cnt;
 	irq_spinlock_unlock(&workq->lock, true);
@@ -593,6 +594,6 @@
 static signal_op_t signal_worker_logic(struct work_queue *workq, bool can_block)
 {
-	ASSERT(!workq_corrupted(workq));
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(!workq_corrupted(workq));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* Only signal workers if really necessary. */
@@ -645,5 +646,5 @@
 			 */
 			if (need_worker && !can_block && 0 == active) {
-				ASSERT(0 == workq->idle_worker_cnt);
+				assert(0 == workq->idle_worker_cnt);
 				
 				irq_spinlock_lock(&nonblock_adder.lock, true);
@@ -681,5 +682,5 @@
 	}
 	
-	ASSERT(arg != NULL);
+	assert(arg != NULL);
 	
 	struct work_queue *workq = arg;
@@ -697,5 +698,5 @@
 static bool dequeue_work(struct work_queue *workq, work_t **pwork_item)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	irq_spinlock_lock(&workq->lock, true);
@@ -704,5 +705,5 @@
 	if (!workq->stopping && worker_unnecessary(workq)) {
 		/* There are too many workers for this load. Exit. */
-		ASSERT(0 < workq->cur_worker_cnt);
+		assert(0 < workq->cur_worker_cnt);
 		--workq->cur_worker_cnt;
 		list_remove(&THREAD->workq_link);
@@ -729,5 +730,5 @@
 		
 #ifdef CONFIG_DEBUG
-		ASSERT(!work_item_corrupted(*pwork_item));
+		assert(!work_item_corrupted(*pwork_item));
 		(*pwork_item)->cookie = 0;
 #endif
@@ -738,5 +739,5 @@
 	} else {
 		/* Requested to stop and no more work queued. */
-		ASSERT(workq->stopping);
+		assert(workq->stopping);
 		--workq->cur_worker_cnt;
 		stop = true;
@@ -751,5 +752,5 @@
 static bool worker_unnecessary(struct work_queue *workq)
 {
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* No work is pending. We don't need too many idle threads. */
@@ -775,11 +776,11 @@
 	
 	/* Ignore lock ordering just here. */
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	_condvar_wait_timeout_irq_spinlock(&workq->activate_worker,
 		&workq->lock, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
 
-	ASSERT(!workq_corrupted(workq));
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(!workq_corrupted(workq));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	THREAD->workq_idling = false;
@@ -791,14 +792,14 @@
 void workq_before_thread_is_ready(thread_t *thread)
 {
-	ASSERT(thread);
-	ASSERT(irq_spinlock_locked(&thread->lock));
+	assert(thread);
+	assert(irq_spinlock_locked(&thread->lock));
 
 	/* Worker's work func() is about to wake up from sleeping. */
 	if (thread->workq && thread->workq_blocked) {
 		/* Must be blocked in user work func() and not be waiting for work. */
-		ASSERT(!thread->workq_idling);
-		ASSERT(thread->state == Sleeping);
-		ASSERT(THREAD != thread);
-		ASSERT(!workq_corrupted(thread->workq));
+		assert(!thread->workq_idling);
+		assert(thread->state == Sleeping);
+		assert(THREAD != thread);
+		assert(!workq_corrupted(thread->workq));
 		
 		/* Protected by thread->lock */
@@ -814,11 +815,11 @@
 void workq_after_thread_ran(void)
 {
-	ASSERT(THREAD);
-	ASSERT(irq_spinlock_locked(&THREAD->lock));
+	assert(THREAD);
+	assert(irq_spinlock_locked(&THREAD->lock));
 
 	/* Worker's work func() is about to sleep/block. */
 	if (THREAD->workq && THREAD->state == Sleeping && !THREAD->workq_idling) {
-		ASSERT(!THREAD->workq_blocked);
-		ASSERT(!workq_corrupted(THREAD->workq));
+		assert(!THREAD->workq_blocked);
+		assert(!workq_corrupted(THREAD->workq));
 		
 		THREAD->workq_blocked = true;
@@ -834,5 +835,5 @@
 		
 		if (op) {
-			ASSERT(add_worker_noblock_op == op || signal_worker_op == op);
+			assert(add_worker_noblock_op == op || signal_worker_op == op);
 			op(THREAD->workq);
 		}
@@ -903,5 +904,5 @@
 			struct work_queue, nb_link);
 
-		ASSERT(!workq_corrupted(*pworkq));
+		assert(!workq_corrupted(*pworkq));
 		
 		list_remove(&(*pworkq)->nb_link);
