]> sourceware.org Git - newlib-cygwin.git/blame - winsup/cygserver/bsd_mutex.h
Cygwin: console: Fix clean up conditions in close()
[newlib-cygwin.git] / winsup / cygserver / bsd_mutex.h
CommitLineData
282113ba
CV
1/* bsd_mutex.h: BSD Mutex helper
2
282113ba
CV
3This file is part of Cygwin.
4
5This software is a copyrighted work licensed under the terms of the
6Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7details. */
8#ifndef _BSD_MUTEX_H
9#define _BSD_MUTEX_H
10
11#define MTX_DEF 0
12
13#define MA_OWNED 1
14#define MA_NOTOWNED 2
15
16#define PZERO (0x20)
17#define PRIO_MASK (0x1f)
18#define PDROP 0x1000
19#define PCATCH 0x2000
20#define PLOCK 0x3000
21
22struct mtx {
23 HANDLE h;
24 const char *name;
25 DWORD owner;
dafef5e2 26 unsigned long cnt;
282113ba
CV
27};
28
29/* Some BSD kernel global mutex. */
30extern struct mtx Giant;
31
32void mtx_init (mtx *, const char *, const void *, int);
4dbcfeb7 33void _mtx_lock (mtx *, DWORD, const char *, int);
282113ba 34#define mtx_lock(m) _mtx_lock((m), (td->ipcblk->winpid), __FILE__, __LINE__)
dafef5e2 35int mtx_owned (mtx *, DWORD);
4dbcfeb7 36void _mtx_assert(mtx *, int, DWORD, const char *, int);
dafef5e2 37#define mtx_assert(m,w,p) _mtx_assert((m),(w),(p),__FILE__,__LINE__)
282113ba
CV
38void _mtx_unlock (mtx *, const char *, int);
39#define mtx_unlock(m) _mtx_unlock((m),__FILE__,__LINE__)
40
41void mtx_destroy (mtx *);
42
43void msleep_init (void);
c5ca43f3
CV
44int _msleep (void *, struct mtx *, int, const char *, int, struct thread *);
45#define msleep(i,m,p,w,t) _msleep((i),(m),(p),(w),(t),(td))
46#define tsleep(i,p,w,t) _msleep((i),NULL,(p),(w),(t),(td))
47int wakeup (void *);
282113ba
CV
48void wakeup_all (void);
49
50#endif /* _BSD_MUTEX_H */
This page took 0.237059 seconds and 6 git commands to generate.