OLD | NEW |
---|---|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 #include "primpl.h" | 6 #include "primpl.h" |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #if defined(WIN95) | 10 #if defined(WIN95) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 PRThreadStack *stack; | 66 PRThreadStack *stack; |
67 | 67 |
68 PR_ASSERT(priority == PR_PRIORITY_NORMAL); | 68 PR_ASSERT(priority == PR_PRIORITY_NORMAL); |
69 | 69 |
70 _pr_terminationCVLock = PR_NewLock(); | 70 _pr_terminationCVLock = PR_NewLock(); |
71 _pr_activeLock = PR_NewLock(); | 71 _pr_activeLock = PR_NewLock(); |
72 | 72 |
73 #ifndef HAVE_CUSTOM_USER_THREADS | 73 #ifndef HAVE_CUSTOM_USER_THREADS |
74 stack = PR_NEWZAP(PRThreadStack); | 74 stack = PR_NEWZAP(PRThreadStack); |
75 #ifdef HAVE_STACK_GROWING_UP | 75 #ifdef HAVE_STACK_GROWING_UP |
76 stack->stackTop = (char*) ((((long)&type) >> _pr_pageShift) | 76 stack->stackTop = (char*) ((((intptr_t)&type) >> _pr_pageShift) |
wtc
2014/12/01 18:34:02
In the NSPR upstream, I changed intptr_t to PRWord
| |
77 << _pr_pageShift); | 77 << _pr_pageShift); |
78 #else | 78 #else |
79 #if defined(SOLARIS) || defined (UNIXWARE) && defined (USR_SVR4_THREADS) | 79 #if defined(SOLARIS) || defined (UNIXWARE) && defined (USR_SVR4_THREADS) |
80 stack->stackTop = (char*) &thread; | 80 stack->stackTop = (char*) &thread; |
81 #else | 81 #else |
82 stack->stackTop = (char*) ((((long)&type + _pr_pageSize - 1) | 82 stack->stackTop = (char*) ((((intptr_t)&type + _pr_pageSize - 1) |
83 >> _pr_pageShift) << _pr_pageShift); | 83 >> _pr_pageShift) << _pr_pageShift); |
84 #endif | 84 #endif |
85 #endif | 85 #endif |
86 #else | 86 #else |
87 /* If stack is NULL, we're using custom user threads like NT fibers. */ | 87 /* If stack is NULL, we're using custom user threads like NT fibers. */ |
88 stack = PR_NEWZAP(PRThreadStack); | 88 stack = PR_NEWZAP(PRThreadStack); |
89 if (stack) { | 89 if (stack) { |
90 stack->stackSize = 0; | 90 stack->stackSize = 0; |
91 _PR_InitializeNativeStack(stack); | 91 _PR_InitializeNativeStack(stack); |
92 } | 92 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 */ | 167 */ |
168 static void _PR_InitializeNativeStack(PRThreadStack *ts) | 168 static void _PR_InitializeNativeStack(PRThreadStack *ts) |
169 { | 169 { |
170 if( ts && (ts->stackTop == 0) ) { | 170 if( ts && (ts->stackTop == 0) ) { |
171 ts->allocSize = ts->stackSize; | 171 ts->allocSize = ts->stackSize; |
172 | 172 |
173 /* | 173 /* |
174 ** Setup stackTop and stackBottom values. | 174 ** Setup stackTop and stackBottom values. |
175 */ | 175 */ |
176 #ifdef HAVE_STACK_GROWING_UP | 176 #ifdef HAVE_STACK_GROWING_UP |
177 ts->allocBase = (char*) ((((long)&ts) >> _pr_pageShift) | 177 ts->allocBase = (char*) ((((intptr_t)&ts) >> _pr_pageShift) |
178 << _pr_pageShift); | 178 << _pr_pageShift); |
179 ts->stackBottom = ts->allocBase + ts->stackSize; | 179 ts->stackBottom = ts->allocBase + ts->stackSize; |
180 ts->stackTop = ts->allocBase; | 180 ts->stackTop = ts->allocBase; |
181 #else | 181 #else |
182 ts->allocBase = (char*) ((((long)&ts + _pr_pageSize - 1) | 182 ts->allocBase = (char*) ((((intptr_t)&ts + _pr_pageSize - 1) |
183 >> _pr_pageShift) << _pr_pageShift); | 183 >> _pr_pageShift) << _pr_pageShift); |
184 ts->stackTop = ts->allocBase; | 184 ts->stackTop = ts->allocBase; |
185 ts->stackBottom = ts->allocBase - ts->stackSize; | 185 ts->stackBottom = ts->allocBase - ts->stackSize; |
186 #endif | 186 #endif |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 void _PR_NotifyJoinWaiters(PRThread *thread) | 190 void _PR_NotifyJoinWaiters(PRThread *thread) |
191 { | 191 { |
192 /* | 192 /* |
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1880 _PR_RUNQ_LOCK(cpu); | 1880 _PR_RUNQ_LOCK(cpu); |
1881 _PR_ADD_RUNQ(thread, cpu, pri); | 1881 _PR_ADD_RUNQ(thread, cpu, pri); |
1882 _PR_RUNQ_UNLOCK(cpu); | 1882 _PR_RUNQ_UNLOCK(cpu); |
1883 if (!_PR_IS_NATIVE_THREAD(me) && (cpu == me->cpu)) { | 1883 if (!_PR_IS_NATIVE_THREAD(me) && (cpu == me->cpu)) { |
1884 if (pri > me->priority) { | 1884 if (pri > me->priority) { |
1885 _PR_SET_RESCHED_FLAG(); | 1885 _PR_SET_RESCHED_FLAG(); |
1886 } | 1886 } |
1887 } | 1887 } |
1888 #endif | 1888 #endif |
1889 } | 1889 } |
OLD | NEW |