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