1ed6f5d66Smrg/*
2ed6f5d66Smrg * Copyright © 2013 Keith Packard
3ed6f5d66Smrg *
4ed6f5d66Smrg * Permission to use, copy, modify, distribute, and sell this software and its
5ed6f5d66Smrg * documentation for any purpose is hereby granted without fee, provided that
6ed6f5d66Smrg * the above copyright notice appear in all copies and that both that copyright
7ed6f5d66Smrg * notice and this permission notice appear in supporting documentation, and
8ed6f5d66Smrg * that the name of the copyright holders not be used in advertising or
9ed6f5d66Smrg * publicity pertaining to distribution of the software without specific,
10ed6f5d66Smrg * written prior permission.  The copyright holders make no representations
11ed6f5d66Smrg * about the suitability of this software for any purpose.  It is provided "as
12ed6f5d66Smrg * is" without express or implied warranty.
13ed6f5d66Smrg *
14ed6f5d66Smrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15ed6f5d66Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16ed6f5d66Smrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17ed6f5d66Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18ed6f5d66Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19ed6f5d66Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20ed6f5d66Smrg * OF THIS SOFTWARE.
21ed6f5d66Smrg */
22ed6f5d66Smrg
23ed6f5d66Smrg#ifndef _XSHMFENCE_PTHREAD_H_
24ed6f5d66Smrg#define _XSHMFENCE_PTHREAD_H_
25ed6f5d66Smrg
26ed6f5d66Smrg#include <pthread.h>
27ed6f5d66Smrg#include <sys/types.h>
28ed6f5d66Smrg
29ed6f5d66Smrgstruct xshmfence {
30ed6f5d66Smrg    pthread_mutex_t lock;
31ed6f5d66Smrg    pthread_cond_t  wakeup;
32ed6f5d66Smrg    int             value;
33ed6f5d66Smrg    int             waiting;
34ed6f5d66Smrg};
35ed6f5d66Smrg
36ed6f5d66Smrgvoid
37ed6f5d66Smrgxshmfence_init(int fd);
38ed6f5d66Smrg
39ed6f5d66Smrg#endif /* _XSHMFENCE_PTHREAD_H_ */
40