OLD | NEW |
---|---|
1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
2 // All rights reserved. | 2 // 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 } | 117 } |
118 if (!__isthreaded) { | 118 if (!__isthreaded) { |
119 init_routine(); | 119 init_routine(); |
120 pthread_once_ran_before_threads = true; | 120 pthread_once_ran_before_threads = true; |
121 return 0; | 121 return 0; |
122 } | 122 } |
123 #endif | 123 #endif |
124 if (pthread_once) { | 124 if (pthread_once) { |
125 return pthread_once(ctl, init_routine); | 125 return pthread_once(ctl, init_routine); |
126 } else { | 126 } else { |
127 if (memcmp(ctl, &pthread_once_init, sizeof(*ctl)) == 0) { | 127 if (memcmp((const void*)(ctl), |
128 (const void*)(&pthread_once_init), | |
129 sizeof(*ctl)) == 0) { | |
Dai Mikurube (NOT FULLTIME)
2013/05/08 14:53:25
Ok, then let's use C++ style cast.
bulach
2013/05/08 16:09:10
:)
it's a double-cast, and not entirely sure it'd
Dai Mikurube (NOT FULLTIME)
2013/05/09 16:29:28
wow, it's long, but I believe it's the better way.
| |
128 init_routine(); | 130 init_routine(); |
129 ++*(char*)(ctl); // make it so it's no longer equal to init | 131 ++*(char*)(ctl); // make it so it's no longer equal to init |
130 } | 132 } |
131 return 0; | 133 return 0; |
132 } | 134 } |
133 } | 135 } |
OLD | NEW |