Index: nspr/pr/include/private/primpl.h |
=================================================================== |
--- nspr/pr/include/private/primpl.h (revision 233722) |
+++ nspr/pr/include/private/primpl.h (working copy) |
@@ -50,6 +50,10 @@ |
#include <sys/sem.h> |
#endif |
+#ifdef HAVE_SYSCALL |
+#include <sys/syscall.h> |
+#endif |
+ |
/************************************************************************* |
***** A Word about Model Dependent Function Naming Convention *********** |
*************************************************************************/ |
@@ -186,6 +190,17 @@ |
NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg); |
+/* |
+ * On Linux and its derivatives POSIX priority scheduling works only for |
+ * real-time threads. On those platforms we set thread's nice values |
+ * instead which requires us to track kernel thread IDs for each POSIX |
+ * thread we create. |
+ */ |
+#if defined(LINUX) && defined(HAVE_SETPRIORITY) && \ |
+ ((defined(HAVE_SYSCALL) && defined(SYS_gettid)) || defined(HAVE_GETTID)) |
+#define _PR_NICE_PRIORITY_SCHEDULING |
+#endif |
+ |
#else /* defined(_PR_PTHREADS) */ |
NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg); |
@@ -1540,6 +1555,9 @@ |
#if defined(_PR_PTHREADS) |
pthread_t id; /* pthread identifier for the thread */ |
+#ifdef _PR_NICE_PRIORITY_SCHEDULING |
+ pid_t tid; /* Linux-specific kernel thread ID */ |
+#endif |
PRBool okToDelete; /* ok to delete the PRThread struct? */ |
PRCondVar *waiting; /* where the thread is waiting | NULL */ |
void *sp; /* recorded sp for garbage collection */ |