threadOnce fix (fixes use of macro)

This commit is contained in:
William Lupton
2000-03-01 23:14:18 +00:00
parent 2e863b53a3
commit 1f57197b5f
2 changed files with 3 additions and 2 deletions

View File

@@ -184,8 +184,9 @@ void threadOnceOsd(threadOnceId *id, void (*func)(void *), void *arg)
semMutexMustTake(onceMutex);
if (*id == 0) {
*id = 1;
*id = -1;
func(arg);
*id = 1;
}
semMutexGive(onceMutex);
}

View File

@@ -44,7 +44,7 @@ epicsShareFunc void epicsShareAPI threadOnceOsd(
#define threadOnce(id,func,arg) \
do { \
threadOnceId *idCopy =(id); \
if(*idCopy == 0) \
if(*idCopy <= 0) \
threadOnceOsd(idCopy,func,arg); \
} while(0)