rsys

Basic data structures and low-level features
git clone git://git.meso-star.fr/rsys.git
Log | Files | Refs | README | LICENSE

mutex.h (1355B)


      1 /* Copyright (C) 2013-2023, 2025 Vincent Forest (vaplv@free.fr)
      2  *
      3  * The RSys library is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published
      5  * by the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * The RSys library is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with the RSys library. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #ifndef MUTEX_H
     17 #define MUTEX_H
     18 
     19 #include "rsys.h"
     20 
     21 BEGIN_DECLS
     22 
     23 struct mutex;
     24 RSYS_API struct mutex* mutex_create(void); /* NULL <=> error */
     25 RSYS_API void mutex_destroy(struct mutex* mutex);
     26 RSYS_API void mutex_lock(struct mutex* mutex);
     27 RSYS_API void mutex_unlock(struct mutex* mutex);
     28 
     29 struct mutex_rw;
     30 RSYS_API struct mutex_rw* mutex_rw_create(void);/* NULL <=> error */
     31 RSYS_API void mutex_rw_destroy(struct mutex_rw* mutex);
     32 RSYS_API void mutex_rw_rlock(struct mutex_rw* mutex);
     33 RSYS_API void mutex_rw_wlock(struct mutex_rw* mutex);
     34 RSYS_API void mutex_rw_unlock(struct mutex_rw* mutex);
     35 
     36 END_DECLS
     37 
     38 #endif /* MUTEX_H */