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 
9 #pragma once
10 
22 #include "os/os_mutex.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 struct dpl_mutex {
32  struct os_mutex mu;
33 };
34 
40 static inline dpl_error_t dpl_mutex_init(struct dpl_mutex *mu)
41 {
42  return (dpl_error_t) os_mutex_init(&mu->mu);
43 }
44 
57 static inline dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, dpl_time_t timeout)
58 {
59  return (dpl_error_t) os_mutex_pend(&mu->mu, timeout);
60 }
61 
70 static inline dpl_error_t dpl_mutex_release(struct dpl_mutex *mu)
71 {
72  return (dpl_error_t) os_mutex_release(&mu->mu);
73 }
74 
75 #ifdef __cplusplus
76 }
77 #endif
os_error_t dpl_error_t
dpl error type
Definition: dpl_error.h:50
static dpl_error_t dpl_mutex_release(struct dpl_mutex *mu)
Release a mutex.
Definition: dpl_mutex.h:70
static dpl_error_t dpl_mutex_pend(struct dpl_mutex *mu, dpl_time_t timeout)
Pend (wait) for a mutex.
Definition: dpl_mutex.h:57
static dpl_error_t dpl_mutex_init(struct dpl_mutex *mu)
Initializes a mutex object.
Definition: dpl_mutex.h:40
os_time_t dpl_time_t
dpl time type
Definition: dpl_types.h:56
dpl mutex wrapper
Definition: dpl_mutex.h:31
struct os_mutex mu
the mutex
Definition: dpl_mutex.h:32