OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H | 103 #elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H |
104 #include <pthread.h> | 104 #include <pthread.h> |
105 static void once(void (*func)(void)) | 105 static void once(void (*func)(void)) |
106 { | 106 { |
107 static pthread_once_t lock = PTHREAD_ONCE_INIT; | 107 static pthread_once_t lock = PTHREAD_ONCE_INIT; |
108 pthread_once(&lock, func); | 108 pthread_once(&lock, func); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 #else | 112 #else |
113 /* No-op version that performs no synchronization. vp8_rtcd() is idempotent, | 113 /* No-op version that performs no synchronization. *_rtcd() is idempotent, |
114 * so as long as your platform provides atomic loads/stores of pointers | 114 * so as long as your platform provides atomic loads/stores of pointers |
115 * no synchronization is strictly necessary. | 115 * no synchronization is strictly necessary. |
116 */ | 116 */ |
117 | 117 |
118 static void once(void (*func)(void)) | 118 static void once(void (*func)(void)) |
119 { | 119 { |
120 static int done; | 120 static int done; |
121 | 121 |
122 if(!done) | 122 if(!done) |
123 { | 123 { |
124 func(); | 124 func(); |
125 done = 1; | 125 done = 1; |
126 } | 126 } |
127 } | 127 } |
128 #endif | 128 #endif |
129 | 129 |
130 #endif // VPX_PORTS_VPX_ONCE_H_ | 130 #endif // VPX_PORTS_VPX_ONCE_H_ |
OLD | NEW |