kayws426 / embox

Automatically exported from code.google.com/p/embox
0 stars 1 forks source link

Cannot use mutex inside timer handler #606

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1) Initialize mutex and timer
mutex_init(&test_lock);
timer_set(&timer, TIMER_PERIODIC, 5000, timer_handler, 0);

2) Try to lock mutex in timer handler
void timer_handler(...)
{
// Try to lock and immediately unlock
  if (!mutex_trylock(&test_lock)) // <<<<<<< failing here
    mutex_unlock(&test_lock);
}

Assert at src/kernel/thread/sync/mutex.c at 67 is triggered:
!critical_inside(__CRITICAL_HARDER(CRITICAL_SCHED_LOCK)

Original issue reported on code.google.com by vladisla...@gmail.com on 25 Apr 2013 at 2:30