Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client / tests / irt_ext / threading.h
1 /*
2  * Copyright (c) 2014 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 /*
8  * This module handles all the testing for thread related functions, namely
9  * thread creation, thread destruction, and thread priorities, and also futex
10  * wait and futex wake functions.
11  *
12  * For the purposes of this test harness, much like other time related test
13  * harnesses time passes by instantly. This means that on futex wait calls with
14  * supplied timeout values, times on the threading_environment will instantly
15  * pass by and will always return ETIMEDOUT.
16  */
17
18 #ifndef NATIVE_CLIENT_TESTS_IRT_EXT_THREADING_H
19 #define NATIVE_CLIENT_TESTS_IRT_EXT_THREADING_H
20
21 struct threading_environment {
22   volatile int num_threads_created;
23   volatile int num_threads_exited;
24   volatile int num_futex_wait_calls;
25   volatile int num_futex_wake_calls;
26
27   volatile int last_set_thread_nice;
28   volatile int current_time;
29 };
30
31 void init_threading_module(void);
32
33 void init_threading_environment(struct threading_environment *env);
34
35 void activate_threading_env(struct threading_environment *env);
36 void deactivate_threading_env(void);
37
38 #endif /* NATIVE_CLIENT_TESTS_IRT_EXT_THREADING_H */