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 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 PRUintn *newIndex, PRThreadPrivateDTOR dtor) | 130 PRUintn *newIndex, PRThreadPrivateDTOR dtor) |
131 { | 131 { |
132 PRStatus rv; | 132 PRStatus rv; |
133 PRInt32 index; | 133 PRInt32 index; |
134 | 134 |
135 if (!_pr_initialized) _PR_ImplicitInitialization(); | 135 if (!_pr_initialized) _PR_ImplicitInitialization(); |
136 | 136 |
137 PR_ASSERT(NULL != newIndex); | 137 PR_ASSERT(NULL != newIndex); |
138 PR_ASSERT(NULL != _pr_tpd_destructors); | 138 PR_ASSERT(NULL != _pr_tpd_destructors); |
139 | 139 |
140 index = PR_AtomicIncrement(&_pr_tpd_highwater) - 1; /* allocate index */ | 140 index = PR_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1; /* allocate index */ |
141 if (_PR_TPD_LIMIT <= index) | 141 if (_PR_TPD_LIMIT <= index) |
142 { | 142 { |
143 PR_SetError(PR_TPD_RANGE_ERROR, 0); | 143 PR_SetError(PR_TPD_RANGE_ERROR, 0); |
144 rv = PR_FAILURE; /* that's just wrong */ | 144 rv = PR_FAILURE; /* that's just wrong */ |
145 } | 145 } |
146 else | 146 else |
147 { | 147 { |
148 _pr_tpd_destructors[index] = dtor; /* record destructor @index */ | 148 _pr_tpd_destructors[index] = dtor; /* record destructor @index */ |
149 *newIndex = (PRUintn)index; /* copy into client's location */ | 149 *newIndex = (PRUintn)index; /* copy into client's location */ |
150 rv = PR_SUCCESS; /* that's okay */ | 150 rv = PR_SUCCESS; /* that's okay */ |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 /* | 271 /* |
272 ** We give up after a fixed number of passes. Any non-NULL | 272 ** We give up after a fixed number of passes. Any non-NULL |
273 ** thread-private data value with a registered destructor | 273 ** thread-private data value with a registered destructor |
274 ** function is not destroyed. | 274 ** function is not destroyed. |
275 */ | 275 */ |
276 memset(self->privateData, 0, self->tpdLength * sizeof(void*)); | 276 memset(self->privateData, 0, self->tpdLength * sizeof(void*)); |
277 } | 277 } |
278 } /* _PR_DestroyThreadPrivate */ | 278 } /* _PR_DestroyThreadPrivate */ |
279 | 279 |
280 #endif /* !XP_BEOS */ | 280 #endif /* !XP_BEOS */ |
OLD | NEW |