summaryrefslogtreecommitdiff
path: root/src/ipc.c
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2009-09-10 12:29:15 +0000
committerbernard.xiong <[email protected]>2009-09-10 12:29:15 +0000
commit3bfe93e36597553c2a781aa4a65e348df8d53bfa (patch)
tree7d20ffeb69439683d55cbc61c5fa5ac0025a2335 /src/ipc.c
parent91ed3ab1833abaa34899dec74a8a6e38c40a6bf7 (diff)
fix mutex release bug
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@45 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/ipc.c')
-rw-r--r--src/ipc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ipc.c b/src/ipc.c
index 26e39692b9..8b54cabbdb 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -764,6 +764,9 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
&(mutex->owner->init_priority));
}
+ /* increase value */
+ mutex->value ++;
+
/* wakeup suspended thread */
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
{
- /* increase value */
- mutex->value ++;
+ /* clear owner */
+ mutex->owner = RT_NULL;
+ mutex->original_priority = 0;
}
/* enable interrupt */