[FFmpeg-devel] [PATCH] lavc/utils: simplify lockmgr
Rostislav Pehlivanov
atomnuker at gmail.com
Mon Nov 27 06:44:19 EET 2017
Again, totally unneded use of the atomic function to set/NULL a local variable.
Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
---
libavcodec/utils.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index de2dcea54d..17388ef637 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -26,7 +26,6 @@
*/
#include "config.h"
-#include "libavutil/atomic.h"
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
@@ -85,9 +84,11 @@ static int default_lockmgr_cb(void **arg, enum AVLockOp op)
av_free(tmp);
return AVERROR(err);
}
- if (avpriv_atomic_ptr_cas(mutex, NULL, tmp)) {
+ if (*mutex) {
pthread_mutex_destroy(tmp);
av_free(tmp);
+ } else {
+ *mutex = tmp;
}
}
@@ -103,8 +104,7 @@ static int default_lockmgr_cb(void **arg, enum AVLockOp op)
case AV_LOCK_DESTROY:
if (*mutex)
pthread_mutex_destroy(*mutex);
- av_free(*mutex);
- avpriv_atomic_ptr_cas(mutex, *mutex, NULL);
+ av_freep(*mutex);
return 0;
}
return 1;
--
2.15.0.417.g466bffb3ac
More information about the ffmpeg-devel
mailing list