1 /* Copyright 2013 Akira Ohta (akohta001@gmail.com)
2 This file is part of ntch.
4 The ntch is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 The ntch is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with ntch. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _NT_PTHREAD_h_
19 #define _NT_PTHREAD_h_
21 #include <semaphore.h>
24 #define NT_PTHREAD_RESULT_NONE 0
25 #define NT_PTHREAD_RESULT_UPDATE_BOARD 1
27 typedef struct tag_nt_pthread_handle *nt_pthread_handle;
28 typedef struct tag_nt_pthread_handle{
32 //typedef struct tag_nt_pthread_result_t *nt_pthread_result_tp;
33 typedef struct tag_nt_pthread_result_t{
38 typedef nt_pthread_result_t (*nt_pthread_fn)(void* data);
39 typedef nt_pthread_result_t (*nt_pthread_result_fn)(nt_pthread_result_t result);
41 extern BOOL nt_pthread_lib_init(int thread_pool_size, int queue_size,
42 const char **error_msg);
43 extern void nt_pthread_lib_finish();
45 extern BOOL nt_pthread_put_que(nt_pthread_handle h_pthread);
46 extern nt_pthread_result_t nt_pthread_get_result_from_que();
49 extern nt_pthread_handle nt_pthread_alloc(
50 nt_pthread_fn func, void *param,
51 nt_pthread_result_fn result_func);
53 extern int nt_pthread_add_ref(nt_pthread_handle h_pthread);
54 extern int nt_pthread_release_ref(nt_pthread_handle h_pthread);
58 #endif /* _NT_PTHREAD_h_ */