Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
6248f238
Commit
6248f238
authored
Nov 12, 2015
by
KO Myung-Hun
Committed by
Michael Niedermayer
Nov 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os2threads: Add pthread_once()
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
b1a32429
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
os2threads.h
compat/os2threads.h
+27
-0
No files found.
compat/os2threads.h
View file @
6248f238
...
...
@@ -32,6 +32,8 @@
#undef __STRICT_ANSI__
/* for _beginthread() */
#include <stdlib.h>
#include <sys/fmutex.h>
#include "libavutil/mem.h"
typedef
TID
pthread_t
;
...
...
@@ -47,6 +49,13 @@ typedef struct {
typedef
void
pthread_condattr_t
;
typedef
struct
{
volatile
int
done
;
_fmutex
mtx
;
}
pthread_once_t
;
#define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
struct
thread_arg
{
void
*
(
*
start_routine
)(
void
*
);
void
*
arg
;
...
...
@@ -163,4 +172,22 @@ static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mute
return
0
;
}
static
av_always_inline
int
pthread_once
(
pthread_once_t
*
once_control
,
void
(
*
init_routine
)(
void
))
{
if
(
!
once_control
->
done
)
{
_fmutex_request
(
&
once_control
->
mtx
,
0
);
if
(
!
once_control
->
done
)
{
init_routine
();
once_control
->
done
=
1
;
}
_fmutex_release
(
&
once_control
->
mtx
);
}
return
0
;
}
#endif
/* AVCODEC_OS2PTHREADS_H */
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