--- /dev/null
+/*\r
+ Copyright 2004-2005 Chris Tallon\r
+\r
+ This file is part of VOMP.\r
+\r
+ VOMP is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ VOMP is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with VOMP; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+*/\r
+#include "mutex.h"\r
+\r
+Mutex::Mutex() {\r
+#ifndef WIN32\r
+ pthread_mutex_init(&my_mutex, NULL);\r
+#else\r
+ my_mutex=CreateMutex(NULL,FALSE,NULL);\r
+#endif\r
+}\r
+\r
+Mutex::~Mutex() {\r
+#ifdef WIN32\r
+ CloseHandle(my_mutex);\r
+#endif\r
+}\r
+\r
+void Mutex::Lock() {\r
+#ifndef WIN32\r
+ pthread_mutex_lock(&my_mutex);\r
+#else\r
+ WaitForSingleObject(my_mutex, INFINITE );\r
+#endif\r
+}\r
+\r
+void Mutex::Unlock() {\r
+#ifndef WIN32\r
+ pthread_mutex_unlock(&my_mutex);\r
+#else\r
+ ReleaseMutex(my_mutex);\r
+#endif\r
+}\r
+\r
--- /dev/null
+/*\r
+ Copyright 2004-2005 Chris Tallon\r
+\r
+ This file is part of VOMP.\r
+\r
+ VOMP is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ VOMP is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with VOMP; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+*/\r
+\r
+#ifndef MUTEX_H\r
+#define MUTEX_H\r
+\r
+#ifndef WIN32\r
+#include <pthread.h>\r
+#else\r
+#include <winsock2.h>\r
+#include <windows.h>\r
+#endif\r
+\r
+\r
+\r
+class Mutex\r
+{\r
+public:\r
+ Mutex();\r
+ ~Mutex();\r
+ void Lock();\r
+ void Unlock();\r
+protected:\r
+#ifndef WIN32\r
+ pthread_mutex_t my_mutex;\r
+#else\r
+ HANDLE my_mutex;\r
+#endif\r
+};\r
+#endif\r