Rename (un)lock_mutex to mutex_(un)lock

For consistency, rename lock_mutex and unlock_mutex to mutex_lock and
mutex_unlock.
hidpi
Romain Vimont 7 years ago
parent ad667bfa20
commit c4266e487b

@ -21,7 +21,7 @@ static int read_packet(void *opaque, uint8_t *buf, int buf_size) {
// set the decoded frame as ready for rendering, and notify
static void push_frame(struct decoder *decoder) {
struct frames *frames = decoder->frames;
lock_mutex(frames->mutex);
mutex_lock(frames->mutex);
if (!decoder->skip_frames) {
while (!frames->rendering_frame_consumed) {
SDL_CondWait(frames->rendering_frame_consumed_cond, frames->mutex);
@ -32,7 +32,7 @@ static void push_frame(struct decoder *decoder) {
frames_swap(frames);
frames->rendering_frame_consumed = SDL_FALSE;
unlock_mutex(frames->mutex);
mutex_unlock(frames->mutex);
static SDL_Event new_frame_event = {
.type = EVENT_NEW_FRAME,

@ -1,14 +1,18 @@
#ifndef LOCKUTIL_H
#define LOCKUTIL_H
static inline void lock_mutex(SDL_mutex *mutex) {
#include <stdlib.h>
#include <SDL2/SDL_log.h>
#include <SDL2/SDL_mutex.h>
static inline void mutex_lock(SDL_mutex *mutex) {
if (SDL_LockMutex(mutex)) {
SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "Could not lock mutex");
exit(1);
}
}
static inline void unlock_mutex(SDL_mutex *mutex) {
static inline void mutex_unlock(SDL_mutex *mutex) {
if (SDL_UnlockMutex(mutex)) {
SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "Could not unlock mutex");
exit(1);

@ -349,7 +349,7 @@ SDL_bool show_screen(const char *serial, Uint16 local_port) {
case SDL_QUIT:
goto screen_quit;
case EVENT_NEW_FRAME:
lock_mutex(frames.mutex);
mutex_lock(frames.mutex);
AVFrame *frame = frames.rendering_frame;
frames.rendering_frame_consumed = SDL_TRUE;
if (!decoder.skip_frames) {
@ -364,7 +364,7 @@ SDL_bool show_screen(const char *serial, Uint16 local_port) {
frame_size = current_frame_size;
update_texture(frame, texture);
unlock_mutex(frames.mutex);
mutex_unlock(frames.mutex);
texture_empty = SDL_FALSE;

Loading…
Cancel
Save