Added SharedMemoryChannel and its comparison with other methods

This commit is contained in:
ftc
2023-02-26 16:12:04 +03:00
parent 81000fb1f4
commit 59589e4017
8 changed files with 668 additions and 34 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");
}
}