OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 | 32 |
33 #if USE(PTHREADS) | 33 #if USE(PTHREADS) |
34 | 34 |
35 #include "wtf/ThreadIdentifierDataPthreads.h" | 35 #include "wtf/ThreadIdentifierDataPthreads.h" |
36 | 36 |
37 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
38 #include "wtf/WTF.h" | 38 #include "wtf/WTF.h" |
39 | 39 |
40 #if OS(ANDROID) | 40 #include <limits.h> |
41 // PTHREAD_KEYS_MAX is not defined in bionic, so explicitly define it here. | 41 |
| 42 // PTHREAD_KEYS_MAX might be not defined (e.g. in certain bionic versions), so e
xplicitly define it here. |
42 #ifndef PTHREAD_KEYS_MAX | 43 #ifndef PTHREAD_KEYS_MAX |
43 #define PTHREAD_KEYS_MAX 1024 | 44 #define PTHREAD_KEYS_MAX 1024 |
44 #endif // PTHREAD_KEYS_MAX | 45 #endif // PTHREAD_KEYS_MAX |
45 #else | |
46 #include <limits.h> | |
47 #endif | |
48 | 46 |
49 namespace WTF { | 47 namespace WTF { |
50 | 48 |
51 pthread_key_t ThreadIdentifierData::m_key = PTHREAD_KEYS_MAX; | 49 pthread_key_t ThreadIdentifierData::m_key = PTHREAD_KEYS_MAX; |
52 | 50 |
53 void threadDidExit(ThreadIdentifier); | 51 void threadDidExit(ThreadIdentifier); |
54 | 52 |
55 ThreadIdentifierData::~ThreadIdentifierData() | 53 ThreadIdentifierData::~ThreadIdentifierData() |
56 { | 54 { |
57 threadDidExit(m_identifier); | 55 threadDidExit(m_identifier); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 89 } |
92 | 90 |
93 threadIdentifierData->m_isDestroyedOnce = true; | 91 threadIdentifierData->m_isDestroyedOnce = true; |
94 // Re-setting the value for key causes another destruct() call after all oth
er thread-specific destructors were called. | 92 // Re-setting the value for key causes another destruct() call after all oth
er thread-specific destructors were called. |
95 pthread_setspecific(m_key, threadIdentifierData); | 93 pthread_setspecific(m_key, threadIdentifierData); |
96 } | 94 } |
97 | 95 |
98 } // namespace WTF | 96 } // namespace WTF |
99 | 97 |
100 #endif // USE(PTHREADS) | 98 #endif // USE(PTHREADS) |
OLD | NEW |