void-packages/srcpkgs/icecat/patches/fix-cpr_linux_threads.patch

71 lines
2.2 KiB
Diff

--- media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_threads.c 2015-08-23 18:02:03.001781892 +0200
+++ media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_threads.c 2015-08-23 18:11:53.961749937 +0200
@@ -2,16 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#include <pthread.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/resource.h>
#include "cpr.h"
#include "cpr_stdlib.h"
#include "cpr_stdio.h"
#include "thread_monitor.h"
#include "prtypes.h"
#include "mozilla/Assertions.h"
-#include <pthread.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/resource.h>
#define LINUX_MIN_THREAD_PRIORITY (-20) /* tbd: check MV linux: current val from Larry port */
#define LINUX_MAX_THREAD_PRIORITY (+19) /* tbd: check MV linux. current val from Larry port */
@@ -92,7 +92,11 @@
* that an application does not attempt to create
* the same thread twice.
*/
+#if defined(__GLIBC__)
threadPtr->u.handleInt = threadId;
+#else
+ threadPtr->u.handlePtr = threadId;
+#endif
threadPtr->threadId = ++id;
CSFLogRegisterThread(threadPtr);
return (cprThread_t)threadPtr;
@@ -115,7 +119,11 @@
cprThreadPtr = (cpr_thread_t *) thread;
MOZ_ASSERT(cprThreadPtr);
+#if defined(__GLIBC__)
pthread_join(cprThreadPtr->u.handleInt, NULL);
+#else
+ pthread_join(cprThreadPtr->u.handlePtr, NULL);
+#endif
}
/**
@@ -143,7 +151,11 @@
/*
* Make sure thread is trying to destroy itself.
*/
+#if defined(__GLIBC__)
if ((pthread_t) cprThreadPtr->u.handleInt == pthread_self()) {
+#else
+ if (pthread_equal(cprThreadPtr->u.handlePtr, pthread_self())) {
+#endif
CPR_INFO("%s: Destroying Thread %d", __FUNCTION__, cprThreadPtr->threadId);
pthread_exit(NULL);
return CPR_SUCCESS;
@@ -210,7 +222,11 @@
cprGetThreadId (cprThread_t thread)
{
if (thread) {
+#if defined(__GLIBC__)
return ((cpr_thread_t *)thread)->u.handleInt;
+#else
+ return ((cpr_thread_t *)thread)->u.handlePtr;
+#endif
}
return 0;
}