Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / ddekit / lock.h @ 14

History | View | Annotate | Download (788 Bytes)

1
#ifndef _DDEKIT_LOCK_H
2
#define _DDEKIT_LOCK_H
3

    
4
#include <ddekit/ddekit.h>
5

    
6
struct ddekit_lock;
7
typedef struct ddekit_lock *ddekit_lock_t;
8

    
9
/* Initialize a DDEKit unlocked lock. */
10
#define ddekit_lock_init        ddekit_lock_init_unlocked
11

    
12
/* Initialize a DDEKit unlocked lock. */
13
void ddekit_lock_init_unlocked(ddekit_lock_t *mtx);
14

    
15
/* Initialize a DDEKit locked lock.  */
16
void ddekit_lock_init_locked(ddekit_lock_t *mtx);
17

    
18
/* Uninitialize a DDEKit lock. */
19
void ddekit_lock_deinit(ddekit_lock_t *mtx);
20

    
21
/* Acquire a lock. */
22
void ddekit_lock_lock(ddekit_lock_t *mtx);
23

    
24
/* Acquire a lock, non-blocking. */
25
int ddekit_lock_try_lock(ddekit_lock_t *mtx);
26

    
27
/* Unlock function. */
28
void ddekit_lock_unlock(ddekit_lock_t *mtx);
29

    
30
/* Get lock owner. */
31
int ddekit_lock_owner(ddekit_lock_t *mtx);
32

    
33
#endif