|
@ -6,7 +6,7 @@ using namespace iflytop; |
|
|
/*******************************************************************************
|
|
|
/*******************************************************************************
|
|
|
* zmutex * |
|
|
* zmutex * |
|
|
*******************************************************************************/ |
|
|
*******************************************************************************/ |
|
|
zmutex::zmutex() {} |
|
|
|
|
|
|
|
|
zmutex::zmutex(const char* name) { this->name = name; } |
|
|
zmutex::~zmutex() { vSemaphoreDelete(recursiveMutex); } |
|
|
zmutex::~zmutex() { vSemaphoreDelete(recursiveMutex); } |
|
|
void zmutex::init() { |
|
|
void zmutex::init() { |
|
|
recursiveMutex = xSemaphoreCreateRecursiveMutex(); |
|
|
recursiveMutex = xSemaphoreCreateRecursiveMutex(); |
|
@ -15,7 +15,9 @@ void zmutex::init() { |
|
|
bool zmutex::isInit() { return recursiveMutex != NULL; } |
|
|
bool zmutex::isInit() { return recursiveMutex != NULL; } |
|
|
void zmutex::lock() { |
|
|
void zmutex::lock() { |
|
|
// ZASSERT(recursiveMutex != NULL);
|
|
|
// ZASSERT(recursiveMutex != NULL);
|
|
|
|
|
|
|
|
|
if (recursiveMutex == NULL) { |
|
|
if (recursiveMutex == NULL) { |
|
|
|
|
|
ZLOGE(TAG, "%s recursiveMutex NULL, init it", name); |
|
|
ZASSERT(recursiveMutex != NULL); |
|
|
ZASSERT(recursiveMutex != NULL); |
|
|
} |
|
|
} |
|
|
xSemaphoreTakeRecursive(recursiveMutex, portMAX_DELAY); |
|
|
xSemaphoreTakeRecursive(recursiveMutex, portMAX_DELAY); |
|
|