#include <security_utilities/threading.h>
#include <security_utilities/globalizer.h>
#include <security_utilities/memutils.h>
+#include <utilities/debugging.h>
#include <unistd.h> // WWDC 2007 thread-crash workaround
#include <syslog.h> // WWDC 2007 thread-crash workaround
Mutex::~Mutex()
{
int result = pthread_mutex_destroy(&me);
+ if(result) {
+ secerror("Probable bug: error destroying Mutex: %d", result);
+ }
check(result);
}
{
lock();
mCount++;
- secdebug("cmutex", "%p up to %d", this, mCount);
unlock();
}
if (!tryLock())
return false;
mCount++;
- secdebug("cmutex", "%p up to %d (was try)", this, mCount);
unlock();
return true;
}
lock();
assert(mCount > 0);
mCount--;
- secdebug("cmutex", "%p down to %d", this, mCount);
unlock();
}
void CountingMutex::finishEnter()
{
mCount++;
- secdebug("cmutex", "%p finish up to %d", this, mCount);
unlock();
}
{
assert(mCount > 0);
mCount--;
- secdebug("cmutex", "%p finish down to %d", this, mCount);
unlock();
}
syslog(LOG_ERR, "too many failed pthread_create() attempts");
}
else
- secdebug("thread", "%p created", self.mIdent);
+ secinfo("thread", "%p created", self.mIdent);
}
void *Thread::runner(void *arg)
// otherwise it will crash if something underneath throws.
{
Thread *me = static_cast<Thread *>(arg);
- secdebug("thread", "%p starting", me->self.mIdent);
+ secinfo("thread", "%p starting", me->self.mIdent);
me->action();
- secdebug("thread", "%p terminating", me->self.mIdent);
+ secinfo("thread", "%p terminating", me->self.mIdent);
delete me;
return NULL;
}