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
d96f0fbe
Commit
d96f0fbe
authored
Dec 22, 2015
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavu: add pthread asserts if ASSERT_LEVEL>1
parent
4c4ebeb5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
thread.h
libavutil/thread.h
+96
-0
No files found.
libavutil/thread.h
View file @
d96f0fbe
...
@@ -30,6 +30,102 @@
...
@@ -30,6 +30,102 @@
#if HAVE_PTHREADS
#if HAVE_PTHREADS
#include <pthread.h>
#include <pthread.h>
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
#include "log.h"
#define ASSERT_PTHREAD_NORET(func, ...) do { \
int ret = func(__VA_ARGS__); \
if (ret) { \
av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func) \
" failed with error: %s\n", av_err2str(AVERROR(ret))); \
abort(); \
} \
} while (0)
#define ASSERT_PTHREAD(func, ...) do { \
ASSERT_PTHREAD_NORET(func, __VA_ARGS__); \
return 0; \
} while (0)
static
inline
int
strict_pthread_join
(
pthread_t
thread
,
void
**
value_ptr
)
{
ASSERT_PTHREAD
(
pthread_join
,
thread
,
value_ptr
);
}
static
inline
int
strict_pthread_mutex_init
(
pthread_mutex_t
*
mutex
,
const
pthread_mutexattr_t
*
attr
)
{
if
(
attr
)
{
ASSERT_PTHREAD_NORET
(
pthread_mutex_init
,
mutex
,
attr
);
}
else
{
pthread_mutexattr_t
local_attr
;
ASSERT_PTHREAD_NORET
(
pthread_mutexattr_init
,
&
local_attr
);
ASSERT_PTHREAD_NORET
(
pthread_mutexattr_settype
,
&
local_attr
,
PTHREAD_MUTEX_ERRORCHECK
);
ASSERT_PTHREAD_NORET
(
pthread_mutex_init
,
mutex
,
&
local_attr
);
ASSERT_PTHREAD_NORET
(
pthread_mutexattr_destroy
,
&
local_attr
);
}
return
0
;
}
static
inline
int
strict_pthread_mutex_destroy
(
pthread_mutex_t
*
mutex
)
{
ASSERT_PTHREAD
(
pthread_mutex_destroy
,
mutex
);
}
static
inline
int
strict_pthread_mutex_lock
(
pthread_mutex_t
*
mutex
)
{
ASSERT_PTHREAD
(
pthread_mutex_lock
,
mutex
);
}
static
inline
int
strict_pthread_mutex_unlock
(
pthread_mutex_t
*
mutex
)
{
ASSERT_PTHREAD
(
pthread_mutex_unlock
,
mutex
);
}
static
inline
int
strict_pthread_cond_init
(
pthread_cond_t
*
cond
,
const
pthread_condattr_t
*
attr
)
{
ASSERT_PTHREAD
(
pthread_cond_init
,
cond
,
attr
);
}
static
inline
int
strict_pthread_cond_destroy
(
pthread_cond_t
*
cond
)
{
ASSERT_PTHREAD
(
pthread_cond_destroy
,
cond
);
}
static
inline
int
strict_pthread_cond_signal
(
pthread_cond_t
*
cond
)
{
ASSERT_PTHREAD
(
pthread_cond_signal
,
cond
);
}
static
inline
int
strict_pthread_cond_broadcast
(
pthread_cond_t
*
cond
)
{
ASSERT_PTHREAD
(
pthread_cond_broadcast
,
cond
);
}
static
inline
int
strict_pthread_cond_wait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
)
{
ASSERT_PTHREAD
(
pthread_cond_wait
,
cond
,
mutex
);
}
static
inline
int
strict_pthread_once
(
pthread_once_t
*
once_control
,
void
(
*
init_routine
)(
void
))
{
ASSERT_PTHREAD
(
pthread_once
,
once_control
,
init_routine
);
}
#define pthread_join strict_pthread_join
#define pthread_mutex_init strict_pthread_mutex_init
#define pthread_mutex_destroy strict_pthread_mutex_destroy
#define pthread_mutex_lock strict_pthread_mutex_lock
#define pthread_mutex_unlock strict_pthread_mutex_unlock
#define pthread_cond_init strict_pthread_cond_init
#define pthread_cond_destroy strict_pthread_cond_destroy
#define pthread_cond_signal strict_pthread_cond_signal
#define pthread_cond_broadcast strict_pthread_cond_broadcast
#define pthread_cond_wait strict_pthread_cond_wait
#define pthread_once strict_pthread_once
#endif
#elif HAVE_OS2THREADS
#elif HAVE_OS2THREADS
#include "compat/os2threads.h"
#include "compat/os2threads.h"
#else
#else
...
...
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