Initial commit. Basic test suite

This commit is contained in:
ftc
2023-03-14 20:56:59 +03:00
commit 4c52d620c5
13 changed files with 667 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#include <string>
#include "mutex.h"
using namespace std;
void LockMutex(pthread_mutex_t &m)
{
int mres;
while ((mres = pthread_mutex_lock(&m)) != 0)
{
if (mres != EAGAIN)
{
throw (string)("Fatal error acquiring mutex");
}
}
}
void ReleaseMutex(pthread_mutex_t &m)
{
int mres = pthread_mutex_unlock(&m);
if (mres != 0)
{
throw (string)("Error releasing mutex");
}
}