Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
6bf5e7d3
Commit
6bf5e7d3
authored
Feb 14, 2016
by
KO Myung-Hun
Committed by
Michael Niedermayer
Feb 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compat/os2threads: support the return value of joined thread
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
22a4046d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
21 deletions
+18
-21
os2threads.h
compat/os2threads.h
+18
-21
No files found.
compat/os2threads.h
View file @
6bf5e7d3
...
...
@@ -35,9 +35,15 @@
#include <sys/builtin.h>
#include <sys/fmutex.h>
#include "libavutil/mem.h"
#include "libavutil/attributes.h"
typedef
struct
{
TID
tid
;
void
*
(
*
start_routine
)(
void
*
);
void
*
arg
;
void
*
result
;
}
pthread_t
;
typedef
TID
pthread_t
;
typedef
void
pthread_attr_t
;
typedef
HMTX
pthread_mutex_t
;
...
...
@@ -58,39 +64,30 @@ typedef struct {
#define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
struct
thread_arg
{
void
*
(
*
start_routine
)(
void
*
);
void
*
arg
;
};
static
void
thread_entry
(
void
*
arg
)
{
struct
thread_arg
*
thread_arg
=
arg
;
thread_arg
->
start_routine
(
thread_arg
->
arg
);
pthread_t
*
thread
=
arg
;
av_free
(
thread_
arg
);
thread
->
result
=
thread
->
start_routine
(
thread
->
arg
);
}
static
av_always_inline
int
pthread_create
(
pthread_t
*
thread
,
const
pthread_attr_t
*
attr
,
void
*
(
*
start_routine
)(
void
*
),
void
*
arg
)
{
struct
thread_arg
*
thread_arg
;
thread_arg
=
av_mallocz
(
sizeof
(
struct
thread_arg
));
if
(
!
thread_arg
)
return
ENOMEM
;
thread
->
start_routine
=
start_routine
;
thread
->
arg
=
arg
;
thread
->
result
=
NULL
;
thread_arg
->
start_routine
=
start_routine
;
thread_arg
->
arg
=
arg
;
*
thread
=
_beginthread
(
thread_entry
,
NULL
,
256
*
1024
,
thread_arg
);
thread
->
tid
=
_beginthread
(
thread_entry
,
NULL
,
1024
*
1024
,
thread
);
return
0
;
}
static
av_always_inline
int
pthread_join
(
pthread_t
thread
,
void
**
value_ptr
)
{
DosWaitThread
((
PTID
)
&
thread
,
DCWW_WAIT
);
DosWaitThread
(
&
thread
.
tid
,
DCWW_WAIT
);
if
(
value_ptr
)
*
value_ptr
=
thread
.
result
;
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment