Loading...
Searching...
No Matches
dpl_mutex.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef DPL_DPL_MUTEX_H
21#define DPL_DPL_MUTEX_H
22
23#include "os/os_mutex.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32struct dpl_mutex {
33 struct os_mutex mu;
34};
35
41static inline dpl_error_t dpl_mutex_init(struct dpl_mutex *mu)
42{
43 return (dpl_error_t) os_mutex_init(&mu->mu);
44}
45
58static inline dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, dpl_time_t timeout)
59{
60 return (dpl_error_t) os_mutex_pend(&mu->mu, timeout);
61}
62
71static inline dpl_error_t dpl_mutex_release(struct dpl_mutex *mu)
72{
73 return (dpl_error_t) os_mutex_release(&mu->mu);
74}
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif /* DPL_DPL_MUTEX_H */
os_error_t dpl_error_t
dpl error type
Definition dpl_error.h:51
static dpl_error_t dpl_mutex_release(struct dpl_mutex *mu)
Release a mutex.
Definition dpl_mutex.h:71
static dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, dpl_time_t timeout)
Pend (wait) for a mutex.
Definition dpl_mutex.h:58
static dpl_error_t dpl_mutex_init(struct dpl_mutex *mu)
Initializes a mutex object.
Definition dpl_mutex.h:41
os_time_t dpl_time_t
dpl time type
Definition dpl_types.h:57
dpl mutex wrapper
Definition dpl_mutex.h:32
struct os_mutex mu
the mutex
Definition dpl_mutex.h:33