1.互斥锁添加volatile,防止被编译优化。
This commit is contained in:
@@ -77,7 +77,7 @@ void mr_object_rename(mr_object_t object, char *name);
|
|||||||
void mr_mutex_init(mr_mutex_t mutex);
|
void mr_mutex_init(mr_mutex_t mutex);
|
||||||
mr_err_t mr_mutex_take(mr_mutex_t mutex, void *owner);
|
mr_err_t mr_mutex_take(mr_mutex_t mutex, void *owner);
|
||||||
mr_err_t mr_mutex_release(mr_mutex_t mutex, void *owner);
|
mr_err_t mr_mutex_release(mr_mutex_t mutex, void *owner);
|
||||||
void *mr_mutex_get_owner(mr_mutex_t mutex);
|
volatile void *mr_mutex_get_owner(mr_mutex_t mutex);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ mr_err_t mr_mutex_release(mr_mutex_t mutex, void *owner)
|
|||||||
*
|
*
|
||||||
* @return A handle to the owner of the mutex, or MR_NULL if without owner.
|
* @return A handle to the owner of the mutex, or MR_NULL if without owner.
|
||||||
*/
|
*/
|
||||||
void *mr_mutex_get_owner(mr_mutex_t mutex)
|
volatile void *mr_mutex_get_owner(mr_mutex_t mutex)
|
||||||
{
|
{
|
||||||
MR_ASSERT(mutex != MR_NULL);
|
MR_ASSERT(mutex != MR_NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user