add rt_task_join for receive task and timerloop task
authorgreg
Fri, 09 May 2008 09:47:56 +0200
changeset 463 f7455fef585f
parent 462 3c5b2eb51922
child 464 7d3637f763be
add rt_task_join for receive task and timerloop task
drivers/timers_xeno/timers_xeno.c
--- a/drivers/timers_xeno/timers_xeno.c	Wed May 07 17:06:20 2008 +0200
+++ b/drivers/timers_xeno/timers_xeno.c	Fri May 09 09:47:56 2008 +0200
@@ -66,6 +66,9 @@
 
 void cleanup_all(void)
 {
+	if (rt_task_join(&timerloop_task) != 0){
+		printf("Failed to join with Timerloop task\n");
+	}
 	rt_task_delete(&timerloop_task);
 }
 
@@ -78,6 +81,9 @@
 	rt_mutex_delete(&condition_mutex);
 	rt_cond_delete(&timer_set);
 	rt_sem_delete(&control_task);
+	if (rt_task_join(&timerloop_task) != 0){
+		printf("Failed to join with Timerloop task\n");
+	}
 	rt_task_delete(&timerloop_task);
 }
 
@@ -165,7 +171,7 @@
 	snprintf(taskname, sizeof(taskname), "timerloop-%d", getpid());
 
 	/* create timerloop_task */
-	ret = rt_task_create(&timerloop_task, taskname, 0, 50, 0);
+	ret = rt_task_create(&timerloop_task, taskname, 0, 50, T_JOINABLE);
 	if (ret) {
 		printf("Failed to create timerloop_task, code %d\n",errno);
 		return;
@@ -199,7 +205,7 @@
 	id++;
 
 	/* create ReceiveLoop_task */
-	ret = rt_task_create(ReceiveLoop_task,taskname,0,50,0);
+	ret = rt_task_create(ReceiveLoop_task,taskname,0,50,T_JOINABLE);
 	if (ret) {
 		printf("Failed to create ReceiveLoop_task number %d, code %d\n", id, errno);
 		return;
@@ -219,6 +225,9 @@
  */
 void WaitReceiveTaskEnd(TASK_HANDLE *ReceiveLoop_task)
 {
+	if (rt_task_join(ReceiveLoop_task) != 0){
+		printf("Failed to join with Receive task\n");
+	}
 	rt_task_delete(ReceiveLoop_task);
 }