1 /*
2 * Copyright (c) 2011 KO Myung-Hun <komh@chollian.net>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file
23 * os2threads to pthreads wrapper
24 */
25
26 #ifndef AVCODEC_OS2PTHREADS_H
27 #define AVCODEC_OS2PTHREADS_H
28
30 #include <os2.h>
31
32 #undef __STRICT_ANSI__ /* for _beginthread() */
33 #include <stdlib.h>
34
37
40
45
47
49 void *(*start_routine)(
void *);
51 };
52
54 {
56
58
60 }
61
63 {
65
66 thread_arg =
av_mallocz(
sizeof(
struct thread_arg));
67
70
71 *thread = _beginthread(
thread_entry, NULL, 256 * 1024, thread_arg);
72
73 return 0;
74 }
75
77 {
78 DosWaitThread((PTID)&thread, DCWW_WAIT);
79
80 return 0;
81 }
82
84 {
85 DosCreateMutexSem(NULL, (PHMTX)mutex, 0,
FALSE);
86
87 return 0;
88 }
89
91 {
92 DosCloseMutexSem(*(PHMTX)mutex);
93
94 return 0;
95 }
96
98 {
99 DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
100
101 return 0;
102 }
103
105 {
106 DosReleaseMutexSem(*(PHMTX)mutex);
107
108 return 0;
109 }
110
112 {
114
116
117 return 0;
118 }
119
121 {
123
124 return 0;
125 }
126
128 {
131
133 }
134
135 return 0;
136 }
137
139 {
142
144 }
145
146 return 0;
147 }
148
150 {
152
154
155 DosWaitEventSem(cond->
event_sem, SEM_INDEFINITE_WAIT);
156
158
159 return 0;
160 }
161
162 #endif /* AVCODEC_OS2PTHREADS_H */