blob: bda8b756ec152ae04da989abf1a85144f88ba249 [file] [log] [blame]
Yaowu Xu9c01aa12016-09-01 14:32:49 -07001/*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3 *
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 */
James Zern183b77d2013-07-30 22:46:58 -070011//
12// Multi-threaded worker
13//
14// Original source:
Johann2967bf32016-06-22 16:08:10 -070015// https://chromium.googlesource.com/webm/libwebp
James Zern183b77d2013-07-30 22:46:58 -070016
James Zerne1cbb132018-08-22 14:10:36 -070017#ifndef AOM_AOM_UTIL_AOM_THREAD_H_
18#define AOM_AOM_UTIL_AOM_THREAD_H_
James Zern183b77d2013-07-30 22:46:58 -070019
Tom Finegan60e653d2018-05-22 11:34:58 -070020#include "config/aom_config.h"
James Zern183b77d2013-07-30 22:46:58 -070021
James Zern40aa9102014-01-18 12:16:11 -080022#ifdef __cplusplus
James Zern183b77d2013-07-30 22:46:58 -070023extern "C" {
24#endif
25
hkuangdd88f482015-02-05 13:59:15 -080026// Set maximum decode threads to be 8 due to the limit of frame buffers
27// and not enough semaphores in the emulation layer on windows.
28#define MAX_DECODE_THREADS 8
Ravi Chaudhary31179482018-10-08 11:12:43 +053029#define MAX_NUM_THREADS 64
hkuangdd88f482015-02-05 13:59:15 -080030
James Zern183b77d2013-07-30 22:46:58 -070031#if CONFIG_MULTITHREAD
32
James Zernd167a1a2015-02-10 12:47:14 -080033#if defined(_WIN32) && !HAVE_PTHREAD_H
clang-format3a992f82016-08-10 17:02:06 -070034#include <errno.h> // NOLINT
Yunqing Wang903801f2013-12-27 15:25:54 -080035#include <process.h> // NOLINT
Jim Bankoskic52d8542013-10-01 15:19:39 -070036#include <windows.h> // NOLINT
James Zern183b77d2013-07-30 22:46:58 -070037typedef HANDLE pthread_t;
38typedef CRITICAL_SECTION pthread_mutex_t;
Johann2967bf32016-06-22 16:08:10 -070039
40#if _WIN32_WINNT >= 0x0600 // Windows Vista / Server 2008 or greater
41#define USE_WINDOWS_CONDITION_VARIABLE
42typedef CONDITION_VARIABLE pthread_cond_t;
43#else
James Zern183b77d2013-07-30 22:46:58 -070044typedef struct {
45 HANDLE waiting_sem_;
46 HANDLE received_sem_;
47 HANDLE signal_event_;
48} pthread_cond_t;
Johann2967bf32016-06-22 16:08:10 -070049#endif // _WIN32_WINNT >= 0x600
50
51#ifndef WINAPI_FAMILY_PARTITION
52#define WINAPI_PARTITION_DESKTOP 1
53#define WINAPI_FAMILY_PARTITION(x) x
54#endif
55
56#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
57#define USE_CREATE_THREAD
58#endif
James Zern183b77d2013-07-30 22:46:58 -070059
Yunqing Wang903801f2013-12-27 15:25:54 -080060//------------------------------------------------------------------------------
61// simplistic pthread emulation layer
James Zern183b77d2013-07-30 22:46:58 -070062
Yunqing Wang903801f2013-12-27 15:25:54 -080063// _beginthreadex requires __stdcall
64#define THREADFN unsigned int __stdcall
65#define THREAD_RETURN(val) (unsigned int)((DWORD_PTR)val)
66
Johann2967bf32016-06-22 16:08:10 -070067#if _WIN32_WINNT >= 0x0501 // Windows XP or greater
68#define WaitForSingleObject(obj, timeout) \
69 WaitForSingleObjectEx(obj, timeout, FALSE /*bAlertable*/)
70#endif
71
clang-format3a992f82016-08-10 17:02:06 -070072static INLINE int pthread_create(pthread_t *const thread, const void *attr,
73 unsigned int(__stdcall *start)(void *),
74 void *arg) {
Yunqing Wang903801f2013-12-27 15:25:54 -080075 (void)attr;
Johann2967bf32016-06-22 16:08:10 -070076#ifdef USE_CREATE_THREAD
clang-format3a992f82016-08-10 17:02:06 -070077 *thread = CreateThread(NULL, /* lpThreadAttributes */
78 0, /* dwStackSize */
79 start, arg, 0, /* dwStackSize */
80 NULL); /* lpThreadId */
Johann2967bf32016-06-22 16:08:10 -070081#else
clang-format3a992f82016-08-10 17:02:06 -070082 *thread = (pthread_t)_beginthreadex(NULL, /* void *security */
83 0, /* unsigned stack_size */
84 start, arg, 0, /* unsigned initflag */
85 NULL); /* unsigned *thrdaddr */
Johann2967bf32016-06-22 16:08:10 -070086#endif
Yunqing Wang903801f2013-12-27 15:25:54 -080087 if (*thread == NULL) return 1;
88 SetThreadPriority(*thread, THREAD_PRIORITY_ABOVE_NORMAL);
89 return 0;
90}
91
clang-format3a992f82016-08-10 17:02:06 -070092static INLINE int pthread_join(pthread_t thread, void **value_ptr) {
Yunqing Wang903801f2013-12-27 15:25:54 -080093 (void)value_ptr;
94 return (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0 ||
95 CloseHandle(thread) == 0);
96}
97
98// Mutex
99static INLINE int pthread_mutex_init(pthread_mutex_t *const mutex,
clang-format3a992f82016-08-10 17:02:06 -0700100 void *mutexattr) {
Yunqing Wang903801f2013-12-27 15:25:54 -0800101 (void)mutexattr;
Johann2967bf32016-06-22 16:08:10 -0700102#if _WIN32_WINNT >= 0x0600 // Windows Vista / Server 2008 or greater
103 InitializeCriticalSectionEx(mutex, 0 /*dwSpinCount*/, 0 /*Flags*/);
104#else
Yunqing Wang903801f2013-12-27 15:25:54 -0800105 InitializeCriticalSection(mutex);
Johann2967bf32016-06-22 16:08:10 -0700106#endif
Yunqing Wang903801f2013-12-27 15:25:54 -0800107 return 0;
108}
109
110static INLINE int pthread_mutex_trylock(pthread_mutex_t *const mutex) {
111 return TryEnterCriticalSection(mutex) ? 0 : EBUSY;
112}
113
114static INLINE int pthread_mutex_lock(pthread_mutex_t *const mutex) {
115 EnterCriticalSection(mutex);
116 return 0;
117}
118
119static INLINE int pthread_mutex_unlock(pthread_mutex_t *const mutex) {
120 LeaveCriticalSection(mutex);
121 return 0;
122}
123
124static INLINE int pthread_mutex_destroy(pthread_mutex_t *const mutex) {
125 DeleteCriticalSection(mutex);
126 return 0;
127}
128
129// Condition
130static INLINE int pthread_cond_destroy(pthread_cond_t *const condition) {
131 int ok = 1;
Johann2967bf32016-06-22 16:08:10 -0700132#ifdef USE_WINDOWS_CONDITION_VARIABLE
133 (void)condition;
134#else
Yunqing Wang903801f2013-12-27 15:25:54 -0800135 ok &= (CloseHandle(condition->waiting_sem_) != 0);
136 ok &= (CloseHandle(condition->received_sem_) != 0);
137 ok &= (CloseHandle(condition->signal_event_) != 0);
Johann2967bf32016-06-22 16:08:10 -0700138#endif
Yunqing Wang903801f2013-12-27 15:25:54 -0800139 return !ok;
140}
141
142static INLINE int pthread_cond_init(pthread_cond_t *const condition,
clang-format3a992f82016-08-10 17:02:06 -0700143 void *cond_attr) {
Yunqing Wang903801f2013-12-27 15:25:54 -0800144 (void)cond_attr;
Johann2967bf32016-06-22 16:08:10 -0700145#ifdef USE_WINDOWS_CONDITION_VARIABLE
146 InitializeConditionVariable(condition);
147#else
hkuangdd88f482015-02-05 13:59:15 -0800148 condition->waiting_sem_ = CreateSemaphore(NULL, 0, MAX_DECODE_THREADS, NULL);
149 condition->received_sem_ = CreateSemaphore(NULL, 0, MAX_DECODE_THREADS, NULL);
Yunqing Wang903801f2013-12-27 15:25:54 -0800150 condition->signal_event_ = CreateEvent(NULL, FALSE, FALSE, NULL);
clang-format3a992f82016-08-10 17:02:06 -0700151 if (condition->waiting_sem_ == NULL || condition->received_sem_ == NULL ||
Yunqing Wang903801f2013-12-27 15:25:54 -0800152 condition->signal_event_ == NULL) {
153 pthread_cond_destroy(condition);
154 return 1;
155 }
Johann2967bf32016-06-22 16:08:10 -0700156#endif
Yunqing Wang903801f2013-12-27 15:25:54 -0800157 return 0;
158}
159
160static INLINE int pthread_cond_signal(pthread_cond_t *const condition) {
161 int ok = 1;
Johann2967bf32016-06-22 16:08:10 -0700162#ifdef USE_WINDOWS_CONDITION_VARIABLE
163 WakeConditionVariable(condition);
164#else
Yunqing Wang903801f2013-12-27 15:25:54 -0800165 if (WaitForSingleObject(condition->waiting_sem_, 0) == WAIT_OBJECT_0) {
166 // a thread is waiting in pthread_cond_wait: allow it to be notified
167 ok = SetEvent(condition->signal_event_);
168 // wait until the event is consumed so the signaler cannot consume
169 // the event via its own pthread_cond_wait.
170 ok &= (WaitForSingleObject(condition->received_sem_, INFINITE) !=
171 WAIT_OBJECT_0);
172 }
Johann2967bf32016-06-22 16:08:10 -0700173#endif
Yunqing Wang903801f2013-12-27 15:25:54 -0800174 return !ok;
175}
176
Deepa K G964e72e2018-05-16 16:56:01 +0530177static INLINE int pthread_cond_broadcast(pthread_cond_t *const condition) {
178 int ok = 1;
179#ifdef USE_WINDOWS_CONDITION_VARIABLE
180 WakeAllConditionVariable(condition);
181#else
182 while (WaitForSingleObject(condition->waiting_sem_, 0) == WAIT_OBJECT_0) {
183 // a thread is waiting in pthread_cond_wait: allow it to be notified
184 ok &= SetEvent(condition->signal_event_);
185 // wait until the event is consumed so the signaler cannot consume
186 // the event via its own pthread_cond_wait.
187 ok &= (WaitForSingleObject(condition->received_sem_, INFINITE) !=
188 WAIT_OBJECT_0);
189 }
190#endif
191 return !ok;
192}
193
Yunqing Wang903801f2013-12-27 15:25:54 -0800194static INLINE int pthread_cond_wait(pthread_cond_t *const condition,
195 pthread_mutex_t *const mutex) {
196 int ok;
Johann2967bf32016-06-22 16:08:10 -0700197#ifdef USE_WINDOWS_CONDITION_VARIABLE
198 ok = SleepConditionVariableCS(condition, mutex, INFINITE);
199#else
Yunqing Wang903801f2013-12-27 15:25:54 -0800200 // note that there is a consumer available so the signal isn't dropped in
201 // pthread_cond_signal
clang-format3a992f82016-08-10 17:02:06 -0700202 if (!ReleaseSemaphore(condition->waiting_sem_, 1, NULL)) return 1;
Yunqing Wang903801f2013-12-27 15:25:54 -0800203 // now unlock the mutex so pthread_cond_signal may be issued
204 pthread_mutex_unlock(mutex);
205 ok = (WaitForSingleObject(condition->signal_event_, INFINITE) ==
206 WAIT_OBJECT_0);
207 ok &= ReleaseSemaphore(condition->received_sem_, 1, NULL);
208 pthread_mutex_lock(mutex);
Johann2967bf32016-06-22 16:08:10 -0700209#endif
Yunqing Wang903801f2013-12-27 15:25:54 -0800210 return !ok;
211}
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900212#elif defined(__OS2__)
213#define INCL_DOS
clang-format3a992f82016-08-10 17:02:06 -0700214#include <os2.h> // NOLINT
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900215
clang-format3a992f82016-08-10 17:02:06 -0700216#include <errno.h> // NOLINT
217#include <stdlib.h> // NOLINT
218#include <sys/builtin.h> // NOLINT
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900219
220#define pthread_t TID
221#define pthread_mutex_t HMTX
222
223typedef struct {
224 HEV event_sem_;
225 HEV ack_sem_;
226 volatile unsigned wait_count_;
227} pthread_cond_t;
228
229//------------------------------------------------------------------------------
230// simplistic pthread emulation layer
231
232#define THREADFN void *
233#define THREAD_RETURN(val) (val)
234
235typedef struct {
clang-format3a992f82016-08-10 17:02:06 -0700236 void *(*start_)(void *);
237 void *arg_;
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900238} thread_arg;
239
clang-format3a992f82016-08-10 17:02:06 -0700240static void thread_start(void *arg) {
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900241 thread_arg targ = *(thread_arg *)arg;
242 free(arg);
243
244 targ.start_(targ.arg_);
245}
246
clang-format3a992f82016-08-10 17:02:06 -0700247static INLINE int pthread_create(pthread_t *const thread, const void *attr,
248 void *(*start)(void *), void *arg) {
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900249 int tid;
250 thread_arg *targ = (thread_arg *)malloc(sizeof(*targ));
251 if (targ == NULL) return 1;
252
253 (void)attr;
254
255 targ->start_ = start;
256 targ->arg_ = arg;
257 tid = (pthread_t)_beginthread(thread_start, NULL, 1024 * 1024, targ);
258 if (tid == -1) {
259 free(targ);
260 return 1;
261 }
262
263 *thread = tid;
264 return 0;
265}
266
clang-format3a992f82016-08-10 17:02:06 -0700267static INLINE int pthread_join(pthread_t thread, void **value_ptr) {
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900268 (void)value_ptr;
269 return DosWaitThread(&thread, DCWW_WAIT) != 0;
270}
271
272// Mutex
273static INLINE int pthread_mutex_init(pthread_mutex_t *const mutex,
clang-format3a992f82016-08-10 17:02:06 -0700274 void *mutexattr) {
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900275 (void)mutexattr;
276 return DosCreateMutexSem(NULL, mutex, 0, FALSE) != 0;
277}
278
279static INLINE int pthread_mutex_trylock(pthread_mutex_t *const mutex) {
280 return DosRequestMutexSem(*mutex, SEM_IMMEDIATE_RETURN) == 0 ? 0 : EBUSY;
281}
282
283static INLINE int pthread_mutex_lock(pthread_mutex_t *const mutex) {
284 return DosRequestMutexSem(*mutex, SEM_INDEFINITE_WAIT) != 0;
285}
286
287static INLINE int pthread_mutex_unlock(pthread_mutex_t *const mutex) {
288 return DosReleaseMutexSem(*mutex) != 0;
289}
290
291static INLINE int pthread_mutex_destroy(pthread_mutex_t *const mutex) {
292 return DosCloseMutexSem(*mutex) != 0;
293}
294
295// Condition
296static INLINE int pthread_cond_destroy(pthread_cond_t *const condition) {
297 int ok = 1;
298 ok &= DosCloseEventSem(condition->event_sem_) == 0;
299 ok &= DosCloseEventSem(condition->ack_sem_) == 0;
300 return !ok;
301}
302
303static INLINE int pthread_cond_init(pthread_cond_t *const condition,
clang-format3a992f82016-08-10 17:02:06 -0700304 void *cond_attr) {
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900305 int ok = 1;
306 (void)cond_attr;
307
clang-format3a992f82016-08-10 17:02:06 -0700308 ok &=
309 DosCreateEventSem(NULL, &condition->event_sem_, DCE_POSTONE, FALSE) == 0;
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900310 ok &= DosCreateEventSem(NULL, &condition->ack_sem_, DCE_POSTONE, FALSE) == 0;
311 if (!ok) {
312 pthread_cond_destroy(condition);
313 return 1;
314 }
315 condition->wait_count_ = 0;
316 return 0;
317}
318
319static INLINE int pthread_cond_signal(pthread_cond_t *const condition) {
320 int ok = 1;
321
322 if (!__atomic_cmpxchg32(&condition->wait_count_, 0, 0)) {
323 ok &= DosPostEventSem(condition->event_sem_) == 0;
324 ok &= DosWaitEventSem(condition->ack_sem_, SEM_INDEFINITE_WAIT) == 0;
325 }
326
327 return !ok;
328}
329
330static INLINE int pthread_cond_broadcast(pthread_cond_t *const condition) {
331 int ok = 1;
332
333 while (!__atomic_cmpxchg32(&condition->wait_count_, 0, 0))
clang-format3a992f82016-08-10 17:02:06 -0700334 ok &= pthread_cond_signal(condition) == 0;
KO Myung-Hun14e8ade2016-05-22 13:57:07 +0900335
336 return !ok;
337}
338
339static INLINE int pthread_cond_wait(pthread_cond_t *const condition,
340 pthread_mutex_t *const mutex) {
341 int ok = 1;
342
343 __atomic_increment(&condition->wait_count_);
344
345 ok &= pthread_mutex_unlock(mutex) == 0;
346
347 ok &= DosWaitEventSem(condition->event_sem_, SEM_INDEFINITE_WAIT) == 0;
348
349 __atomic_decrement(&condition->wait_count_);
350
351 ok &= DosPostEventSem(condition->ack_sem_) == 0;
352
353 pthread_mutex_lock(mutex);
354
355 return !ok;
356}
clang-format3a992f82016-08-10 17:02:06 -0700357#else // _WIN32
358#include <pthread.h> // NOLINT
359#define THREADFN void *
360#define THREAD_RETURN(val) val
Yunqing Wang903801f2013-12-27 15:25:54 -0800361#endif
James Zern183b77d2013-07-30 22:46:58 -0700362
Yunqing Wang903801f2013-12-27 15:25:54 -0800363#endif // CONFIG_MULTITHREAD
James Zern183b77d2013-07-30 22:46:58 -0700364
365// State of the worker thread object
Satish Kumar Suman9b1252e2018-12-25 11:21:18 +0530366typedef enum {
clang-format3a992f82016-08-10 17:02:06 -0700367 NOT_OK = 0, // object is unusable
368 OK, // ready to work
369 WORK // busy finishing the current task
Satish Kumar Suman9b1252e2018-12-25 11:21:18 +0530370} AVxWorkerStatus;
James Zern183b77d2013-07-30 22:46:58 -0700371
372// Function to be called by the worker thread. Takes two opaque pointers as
Wan-Teh Chang3f0cbf12018-07-03 14:59:18 -0700373// arguments (data1 and data2). Should return true on success and return false
374// in case of error.
Yaowu Xuf883b422016-08-30 14:01:10 -0700375typedef int (*AVxWorkerHook)(void *, void *);
James Zern183b77d2013-07-30 22:46:58 -0700376
James Zerne656f442014-06-19 21:14:51 -0700377// Platform-dependent implementation details for the worker.
Yaowu Xuf883b422016-08-30 14:01:10 -0700378typedef struct AVxWorkerImpl AVxWorkerImpl;
James Zerne656f442014-06-19 21:14:51 -0700379
380// Synchronization object used to launch job in the worker thread
James Zern183b77d2013-07-30 22:46:58 -0700381typedef struct {
Yaowu Xuf883b422016-08-30 14:01:10 -0700382 AVxWorkerImpl *impl_;
383 AVxWorkerStatus status_;
Wan-Teh Chang4d29ee82018-09-20 10:07:52 -0700384 // Thread name for the debugger. If not NULL, must point to a string that
385 // outlives the worker thread. For portability, use a name <= 15 characters
386 // long (not including the terminating NUL character).
387 const char *thread_name;
Yaowu Xuf883b422016-08-30 14:01:10 -0700388 AVxWorkerHook hook; // hook to call
clang-format3a992f82016-08-10 17:02:06 -0700389 void *data1; // first argument passed to 'hook'
390 void *data2; // second argument passed to 'hook'
Wan-Teh Chang3f0cbf12018-07-03 14:59:18 -0700391 int had_error; // true if a call to 'hook' returned false
Yaowu Xuf883b422016-08-30 14:01:10 -0700392} AVxWorker;
James Zern183b77d2013-07-30 22:46:58 -0700393
James Zerne656f442014-06-19 21:14:51 -0700394// The interface for all thread-worker related functions. All these functions
395// must be implemented.
396typedef struct {
397 // Must be called first, before any other method.
Yaowu Xuf883b422016-08-30 14:01:10 -0700398 void (*init)(AVxWorker *const worker);
James Zerne656f442014-06-19 21:14:51 -0700399 // Must be called to initialize the object and spawn the thread. Re-entrant.
400 // Will potentially launch the thread. Returns false in case of error.
Yaowu Xuf883b422016-08-30 14:01:10 -0700401 int (*reset)(AVxWorker *const worker);
James Zerne656f442014-06-19 21:14:51 -0700402 // Makes sure the previous work is finished. Returns true if worker->had_error
403 // was not set and no error condition was triggered by the working thread.
Yaowu Xuf883b422016-08-30 14:01:10 -0700404 int (*sync)(AVxWorker *const worker);
James Zerne656f442014-06-19 21:14:51 -0700405 // Triggers the thread to call hook() with data1 and data2 arguments. These
406 // hook/data1/data2 values can be changed at any time before calling this
407 // function, but not be changed afterward until the next call to Sync().
Yaowu Xuf883b422016-08-30 14:01:10 -0700408 void (*launch)(AVxWorker *const worker);
James Zerne656f442014-06-19 21:14:51 -0700409 // This function is similar to launch() except that it calls the
410 // hook directly instead of using a thread. Convenient to bypass the thread
Yaowu Xuf883b422016-08-30 14:01:10 -0700411 // mechanism while still using the AVxWorker structs. sync() must
James Zerne656f442014-06-19 21:14:51 -0700412 // still be called afterward (for error reporting).
Yaowu Xuf883b422016-08-30 14:01:10 -0700413 void (*execute)(AVxWorker *const worker);
James Zerne656f442014-06-19 21:14:51 -0700414 // Kill the thread and terminate the object. To use the object again, one
415 // must call reset() again.
Yaowu Xuf883b422016-08-30 14:01:10 -0700416 void (*end)(AVxWorker *const worker);
417} AVxWorkerInterface;
James Zerne656f442014-06-19 21:14:51 -0700418
419// Install a new set of threading functions, overriding the defaults. This
420// should be done before any workers are started, i.e., before any encoding or
421// decoding takes place. The contents of the interface struct are copied, it
422// is safe to free the corresponding memory after this call. This function is
423// not thread-safe. Return false in case of invalid pointer or methods.
Yaowu Xuf883b422016-08-30 14:01:10 -0700424int aom_set_worker_interface(const AVxWorkerInterface *const winterface);
James Zerne656f442014-06-19 21:14:51 -0700425
426// Retrieve the currently set thread worker interface.
Yaowu Xuf883b422016-08-30 14:01:10 -0700427const AVxWorkerInterface *aom_get_worker_interface(void);
James Zern183b77d2013-07-30 22:46:58 -0700428
429//------------------------------------------------------------------------------
430
James Zern40aa9102014-01-18 12:16:11 -0800431#ifdef __cplusplus
clang-format3a992f82016-08-10 17:02:06 -0700432} // extern "C"
James Zern183b77d2013-07-30 22:46:58 -0700433#endif
434
James Zerne1cbb132018-08-22 14:10:36 -0700435#endif // AOM_AOM_UTIL_AOM_THREAD_H_