fix mutex release bug

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@45 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2009-09-10 12:29:15 +00:00
parent 91ed3ab183
commit 3bfe93e365
1 changed files with 6 additions and 2 deletions

View File

@ -764,6 +764,9 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
&(mutex->owner->init_priority)); &(mutex->owner->init_priority));
} }
/* increase value */
mutex->value ++;
/* wakeup suspended thread */ /* wakeup suspended thread */
if (mutex->value <= 0 && mutex->parent.suspend_thread_count > 0) if (mutex->value <= 0 && mutex->parent.suspend_thread_count > 0)
{ {
@ -783,8 +786,9 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
} }
else else
{ {
/* increase value */ /* clear owner */
mutex->value ++; mutex->owner = RT_NULL;
mutex->original_priority = 0;
} }
/* enable interrupt */ /* enable interrupt */