Commit 6600ac83 authored by Claes Sjöfors's avatar Claes Sjöfors

Lock bugfix

parent d63ea98c
...@@ -44,16 +44,21 @@ ...@@ -44,16 +44,21 @@
static char lck_cName[lck_eLock__][40] static char lck_cName[lck_eLock__][40]
= { "/tmp/pwr_nmps_lock", "/tmp/pwr_time_lock", "/tmp/pwr_str_lock" }; = { "/tmp/pwr_nmps_lock", "/tmp/pwr_time_lock", "/tmp/pwr_str_lock" };
sect_sHead* lck_locksect[lck_eLock__] = { 0, 0 }; sect_sHead* lck_locksect[lck_eLock__] = {0, 0, 0};
void lck_Create(pwr_tStatus* sts, lck_eLock lock) void lck_Create(pwr_tStatus* sts, lck_eLock lock)
{ {
pwr_tBoolean created; pwr_tBoolean created;
if (lock >= lck_eLock__ || lck_locksect[lock]) { if (lock >= lck_eLock__) {
*sts = 0; *sts = 0;
return; return;
} }
if (lck_locksect[lock]) {
/* Already created */
*sts = 1;
return;
}
lck_locksect[lock] = sect_Alloc(sts, &created, 0, sizeof(sect_sMutex), lck_locksect[lock] = sect_Alloc(sts, &created, 0, sizeof(sect_sMutex),
lck_cName[lock], sect_mFlags_Create); lck_cName[lock], sect_mFlags_Create);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment