Commit Graph

21 Commits

Author SHA1 Message Date
Marton Balint 71ea90638e avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-05 09:42:30 +01:00
Brad Smith fd16d8c68c avutil/thread: add support for setting thread name on *bsd and solaris
FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses pthread_set_name_np().

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:45:10 +01:00
James Almer 8c789c5da3 avutil/thread: add wrappers for pthread_cond_t functions
This abstraction is similar to the existing one for pthread_mutex_t and
pthread_once_t functions, and should reduce the amount of ifdeffery used
in future code.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-08-19 10:03:07 -03:00
Anton Khirnov f66e794672 lavu/thread: add an internal function for setting thread name
Linux-only for now.
2022-10-24 02:00:31 +02:00
Andreas Rheinhardt 321a3c244d avutil/log: Don't include avutil.h
It has been included since af5f434f8c
for deprecation reasons, but removing it has been forgotten after
it had served is purpose. So remove it.

For convenience, include version.h instead as LIBAVUTIL_VERSION_INT
is supposed to be used when creating AVClasses.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Marton Balint 1812b42554 avutil/thread: fix strict_pthread_cond_timedwait
Timeout error was assumed to be fatal which it is not.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-25 23:16:18 +01:00
Matt Oliver fc6fde22c3 avutil/thread: Add pthread_cond_timedwait function
v2: fix calculating milisecond times and use SleepConditionVariableSRW.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
2020-01-21 22:34:15 +01:00
wm4 a04c2c707d lavc: replace and deprecate the lock manager
Use static mutexes instead of requiring a lock manager. The behavior
should be roughly the same before and after this change for API users
which did not set the lock manager at all (except that a minor memory
leak disappears).
2017-12-26 02:50:00 +01:00
James Almer 00bfe8509c Merge commit '193b09189004ede4a6998e69192d1a9f63602088'
* commit '193b09189004ede4a6998e69192d1a9f63602088':
  thread: Define ff_mutex_* macros as stub functions when threads are disabled

Merged-by: James Almer <jamrial@gmail.com>
2017-10-26 17:13:14 -03:00
Aaron Levinson 5b281b476b libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1
Purpose: libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL
is greater than 1.  This is only relevant when thread.h is included by
C++ files.  In this case, the relevant code is only defined if
HAVE_PTHREADS is defined as 1.  Use configure --assert-level=2 to do
so.

Note: Issue discovered as a result of Coverity build failure.  Cause
of build failure pinpointed by Hendrik Leppkes.

Comments:

-- libavutil/thread.h: Altered ASSERT_PTHREAD_NORET definition such
   that it uses av_make_error_string instead of av_err2str().
   av_err2str() uses a "parenthesized type followed by an initializer
   list", which is apparently not valid C++.  This issue started
   occurring because thread.h is now included by the DeckLink C++
   files.  The alteration does the equivalent of what av_err2str()
   does, but instead declares the character buffer as a local
   variable.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-04-22 23:32:41 +02:00
Diego Biurrun 193b091890 thread: Define ff_mutex_* macros as stub functions when threads are disabled
Silences a bunch of "statement with no effect" warnings with threads disabled.
2017-04-12 10:07:09 +02:00
Clément Bœsch 67d8eabdbb lavu/buffer: drop USE_ATOMICS
USE_ATOMICS is only set if there is no thread implementation enabled, in
which case you can't expect any lock mechanism from FFmpeg.

This is also conflicting with the incoming use of stdatomic.
2017-03-22 17:40:03 +01:00
Clément Bœsch d96f0fbe59 lavu: add pthread asserts if ASSERT_LEVEL>1 2016-01-20 21:08:50 +01:00
Hendrik Leppkes f05021f3f4 Merge commit 'c53e796f8b69799b7ad6d28fbab981d37edf1bc9'
* commit 'c53e796f8b69799b7ad6d28fbab981d37edf1bc9':
  thread: Provide no-op variants for pthread_once

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-14 23:02:35 +02:00
Luca Barbato c53e796f8b thread: Provide no-op variants for pthread_once 2015-10-14 14:35:34 +02:00
Anton Khirnov e10e6651b5 thread: use "" instead of <> for including the w32pthreads wrapper
Found-by: Dave Yeo <dave.r.yeo@gmail.com>
2014-12-14 18:15:57 +01:00
Michael Niedermayer c299b6fd08 avutil/buffer: Move USE_ATOMICS to thread.h to avoid it becoming out of sync with it
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-29 12:26:22 +01:00
Dave Yeo 32eadfe453 libavutil/threads.h: correct an include to be local
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-29 11:56:28 +01:00
Dave Yeo 090a7801a8 libavutil/thread.h: Support OS/2 threads
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-29 11:56:22 +01:00
Michael Niedermayer 4760278007 Merge commit '2443e522f0059176ff8717c9c753eb6fe7e7bbf1'
* commit '2443e522f0059176ff8717c9c753eb6fe7e7bbf1':
  lavu: add wrappers for the pthreads mutex API

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-27 22:08:17 +01:00
Anton Khirnov 2443e522f0 lavu: add wrappers for the pthreads mutex API
Also add no-op fallbacks when threading is disabled.

This helps keeping the code clean if Libav is compiled for targets
without threading. Since we assume that no threads of any kind are used
in such configurations, doing nothing is ok by definition.

Based on a patch by wm4 <nfxjfg@googlemail.com>.
2014-11-27 13:36:00 +01:00