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 | 7 |
8 _PRCPU *_pr_primordialCPU = NULL; | 8 _PRCPU *_pr_primordialCPU = NULL; |
9 | 9 |
10 PRInt32 _pr_md_idle_cpus; /* number of idle cpus */ | 10 PRInt32 _pr_md_idle_cpus; /* number of idle cpus */ |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 static _PRCPUQueue *_PR_CreateCPUQueue(void) | 117 static _PRCPUQueue *_PR_CreateCPUQueue(void) |
118 { | 118 { |
119 PRInt32 index; | 119 PRInt32 index; |
120 _PRCPUQueue *cpuQueue; | 120 _PRCPUQueue *cpuQueue; |
121 cpuQueue = PR_NEWZAP(_PRCPUQueue); | 121 cpuQueue = PR_NEWZAP(_PRCPUQueue); |
122 | 122 |
123 _MD_NEW_LOCK( &cpuQueue->runQLock ); | 123 _MD_NEW_LOCK( &cpuQueue->runQLock ); |
124 _MD_NEW_LOCK( &cpuQueue->sleepQLock ); | 124 _MD_NEW_LOCK( &cpuQueue->sleepQLock ); |
125 _MD_NEW_LOCK( &cpuQueue->miscQLock ); | 125 _MD_NEW_LOCK( &cpuQueue->miscQLock ); |
126 | 126 |
127 for (index = 0; index < PR_PRIORITY_LAST + 1; index++) | 127 for (index = 0; index < PR_ARRAY_SIZE(cpuQueue->runQ); index++) |
128 PR_INIT_CLIST( &(cpuQueue->runQ[index]) ); | 128 PR_INIT_CLIST( &(cpuQueue->runQ[index]) ); |
129 PR_INIT_CLIST( &(cpuQueue->sleepQ) ); | 129 PR_INIT_CLIST( &(cpuQueue->sleepQ) ); |
130 PR_INIT_CLIST( &(cpuQueue->pauseQ) ); | 130 PR_INIT_CLIST( &(cpuQueue->pauseQ) ); |
131 PR_INIT_CLIST( &(cpuQueue->suspendQ) ); | 131 PR_INIT_CLIST( &(cpuQueue->suspendQ) ); |
132 PR_INIT_CLIST( &(cpuQueue->waitingToJoinQ) ); | 132 PR_INIT_CLIST( &(cpuQueue->waitingToJoinQ) ); |
133 | 133 |
134 cpuQueue->numCPUs = 1; | 134 cpuQueue->numCPUs = 1; |
135 | 135 |
136 return cpuQueue; | 136 return cpuQueue; |
137 } | 137 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 #endif | 396 #endif |
397 } | 397 } |
398 | 398 |
399 PR_IMPLEMENT(_PRCPU *) _PR_GetPrimordialCPU(void) | 399 PR_IMPLEMENT(_PRCPU *) _PR_GetPrimordialCPU(void) |
400 { | 400 { |
401 if (_pr_primordialCPU) | 401 if (_pr_primordialCPU) |
402 return _pr_primordialCPU; | 402 return _pr_primordialCPU; |
403 else | 403 else |
404 return _PR_MD_CURRENT_CPU(); | 404 return _PR_MD_CURRENT_CPU(); |
405 } | 405 } |
OLD | NEW |