File: mutex.h

package info (click to toggle)
vdo 8.3.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,536 kB
  • sloc: ansic: 21,023; sh: 349; makefile: 314; perl: 242
file content (24 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Wrap our own mutexes to mimic the kernel.
 *
 * Copyright 2023 Red Hat
 *
 */

#ifndef LINUX_MUTEX_H
#define LINUX_MUTEX_H

#include "thread-utils.h"

#define DEFINE_MUTEX(mutexname) \
	struct mutex mutexname = UDS_MUTEX_INITIALIZER

#define mutex_destroy(mutex) uds_destroy_mutex(mutex)
#define mutex_init(mutex) \
	VDO_ASSERT_LOG_ONLY(uds_init_mutex(mutex) == UDS_SUCCESS, \
			    "mutex init succeeds")
#define mutex_lock(mutex) uds_lock_mutex(mutex)
#define mutex_unlock(mutex) uds_unlock_mutex(mutex)

#endif // LINUX_MUTEX_H