Worker thread wake test protected by rtl_no_interrupts.
authorwentasah <wentasah>
Mon, 14 Mar 2005 10:38:16 +0000 (10:38 +0000)
committerwentasah <wentasah>
Mon, 14 Mar 2005 10:38:16 +0000 (10:38 +0000)
lincan/src/can_devrtl.c

index 0520902..ad6d6c2 100644 (file)
@@ -95,6 +95,7 @@ void * can_chip_worker_thread(void *arg)
        struct msgobj_t *obj;
        int ret, i;
        int loop_cnt;
+       rtl_irqstate_t flags;
        
        if(!chip) return 0;
        
@@ -161,11 +162,14 @@ void * can_chip_worker_thread(void *arg)
 
                }
 
+                rtl_no_interrupts (flags);
                RTL_MARK_SUSPENDED(pthread_self());
                if(test_and_clear_bit(MSGOBJ_WORKER_WAKE_b,&chip->pend_flags)){
                        RTL_MARK_READY(pthread_self());
+                        rtl_restore_interrupts (flags);
                        continue;
                }
+                rtl_restore_interrupts (flags);
                rtl_schedule();
 
        }