diff options
author | Piotr Piastucki <leech.miranda@gmail.com> | 2014-08-13 13:46:55 +0000 |
---|---|---|
committer | Piotr Piastucki <leech.miranda@gmail.com> | 2014-08-13 13:46:55 +0000 |
commit | 96674592dd3493682a6cccb0b3dcf8ca019fd7a4 (patch) | |
tree | f42a68584d07fc2fd4a70c5866181327471e8f53 /protocols/SkypeClassic/src/pthread.c | |
parent | 3cf0b793fe90993ff333ba53104796f0c280118a (diff) |
Made SkypeClassic plugin compatible with Miranda IM again so that plugins for both IMs can be maintained with one codebase.
Compatibility wrapper for Miranda IM is in ng-compat/m_core.h
Changed files back to C and removed C++ code.
Changed Miranda NG project files so that the c files compile as C++ in order to be compatible with Miranda NG headers (/TP).
Added back build scripts and make file to automatically build Miranda IM version using Makefile.
git-svn-id: http://svn.miranda-ng.org/main/trunk@10177 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeClassic/src/pthread.c')
-rw-r--r-- | protocols/SkypeClassic/src/pthread.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/protocols/SkypeClassic/src/pthread.c b/protocols/SkypeClassic/src/pthread.c new file mode 100644 index 0000000000..12da5a7a4f --- /dev/null +++ b/protocols/SkypeClassic/src/pthread.c @@ -0,0 +1,70 @@ +/*
+ * $Id: pthread.c,v 1.4 2003/12/19 12:53:36 gena01 Exp $
+ *
+ * Skype Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * Code borrowed for Skype plugin. Fixed to compile on Mingw by G.Feldman
+ * Original Copyright (c) 2003 Robert Rainwater
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+
+#include "skype.h"
+
+/* Gena01 - added some defined to fix compilation with mingw gcc */
+/* __try/__finally taken from abiword patch found on the web */
+#if 0
+ #include <crtdbg.h>
+#else
+#define __try
+#define __except(x) if (0) /* don't execute handler */
+#define __finally
+
+#define _try __try
+#define _except __except
+#define _finally __finally
+#endif
+
+#include <excpt.h>
+
+struct pthread_arg
+{
+ HANDLE hEvent;
+ void (*threadcode) (void *);
+ void *arg;
+};
+
+void pthread_r(struct pthread_arg *fa)
+{
+ void (*callercode) (void *) = fa->threadcode;
+ void *arg = fa->arg;
+ Thread_Push(0, 0);
+ SetEvent(fa->hEvent);
+ __try {
+ callercode(arg);
+ }
+ __finally {
+ Thread_Pop();
+ }
+}
+
+unsigned long pthread_create(pThreadFunc parFunc, void *arg)
+{
+ unsigned long rc;
+ struct pthread_arg fa;
+ fa.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ fa.threadcode = parFunc;
+ fa.arg = arg;
+ rc = _beginthread((pThreadFunc) pthread_r, 0, &fa);
+ if ((unsigned long) -1L != rc) {
+ WaitForSingleObject(fa.hEvent, INFINITE);
+ }
+ CloseHandle(fa.hEvent);
+ return rc;
+}
+
|