SphinxBase
0.6
Main Page
Related Pages
Data Structures
Files
File List
Globals
sbthread.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/* ====================================================================
3
* Copyright (c) 2008 Carnegie Mellon University. All rights
4
* reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
*
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
*
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in
15
* the documentation and/or other materials provided with the
16
* distribution.
17
*
18
* This work was supported in part by funding from the Defense Advanced
19
* Research Projects Agency and the National Science Foundation of the
20
* United States of America, and the CMU Sphinx Speech Consortium.
21
*
22
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*
34
* ====================================================================
35
*
36
*/
43
#ifndef __SBTHREAD_H__
44
#define __SBTHREAD_H__
45
46
#include <sphinx_config.h>
47
48
#include <sphinxbase/sphinxbase_export.h>
49
#include <
sphinxbase/cmd_ln.h
>
50
51
#ifdef __cplusplus
52
extern
"C"
{
53
#endif
54
#if 0
55
/* Fool Emacs. */
56
}
57
#endif
58
62
typedef
struct
sbthread_s
sbthread_t
;
63
67
typedef
struct
sbmsgq_s
sbmsgq_t
;
68
72
typedef
struct
sbmtx_s
sbmtx_t
;
73
77
typedef
struct
sbevent_s
sbevent_t
;
78
82
typedef
int (*
sbthread_main
)(
sbthread_t
*th);
83
87
SPHINXBASE_EXPORT
88
sbthread_t
*
sbthread_start
(
cmd_ln_t
*config,
sbthread_main
func,
void
*arg);
89
93
SPHINXBASE_EXPORT
94
int
sbthread_wait
(
sbthread_t
*th);
95
99
SPHINXBASE_EXPORT
100
void
sbthread_free
(
sbthread_t
*th);
101
105
SPHINXBASE_EXPORT
106
cmd_ln_t
*
sbthread_config
(
sbthread_t
*th);
107
111
SPHINXBASE_EXPORT
112
void
*
sbthread_arg
(
sbthread_t
*th);
113
117
SPHINXBASE_EXPORT
118
sbmsgq_t
*
sbthread_msgq
(
sbthread_t
*th);
119
123
SPHINXBASE_EXPORT
124
int
sbthread_wait
(
sbthread_t
*th);
125
132
SPHINXBASE_EXPORT
133
int
sbthread_send
(
sbthread_t
*th,
size_t
len,
void
const
*data);
134
140
SPHINXBASE_EXPORT
141
sbmsgq_t
*
sbmsgq_init
(
size_t
depth);
142
146
SPHINXBASE_EXPORT
147
void
sbmsgq_free
(
sbmsgq_t
*q);
148
152
SPHINXBASE_EXPORT
153
int
sbmsgq_send
(
sbmsgq_t
*q,
size_t
len,
void
const
*data);
154
158
SPHINXBASE_EXPORT
159
void
*
sbmsgq_wait
(
sbmsgq_t
*q,
size_t
*out_len,
int
sec,
int
nsec);
160
164
SPHINXBASE_EXPORT
165
sbmtx_t
*
sbmtx_init
(
void
);
166
170
SPHINXBASE_EXPORT
171
int
sbmtx_trylock
(
sbmtx_t
*mtx);
172
176
SPHINXBASE_EXPORT
177
int
sbmtx_lock
(
sbmtx_t
*mtx);
178
182
SPHINXBASE_EXPORT
183
int
sbmtx_unlock
(
sbmtx_t
*mtx);
184
188
SPHINXBASE_EXPORT
189
void
sbmtx_free
(
sbmtx_t
*mtx);
190
194
SPHINXBASE_EXPORT
195
sbevent_t
*
sbevent_init
(
void
);
196
200
SPHINXBASE_EXPORT
201
void
sbevent_free
(
sbevent_t
*evt);
202
206
SPHINXBASE_EXPORT
207
int
sbevent_signal
(
sbevent_t
*evt);
208
212
SPHINXBASE_EXPORT
213
int
sbevent_wait
(
sbevent_t
*evt,
int
sec,
int
nsec);
214
215
216
#ifdef __cplusplus
217
}
218
#endif
219
220
221
#endif
/* __SBTHREAD_H__ */
include
sphinxbase
sbthread.h
Generated by
1.8.1.1