vfs: check userland buffers before reading them.
[haiku.git] / headers / private / graphics / common / benaphore.h
blob3d9c3e1376fc451ee79faf7279980de8507669a9
1 /*
2 Copyright (c) 2002, Thomas Kurschel
5 Part of Radeon driver
7 Benaphore definition
8 */
11 #ifndef _BENAPHORE_H
12 #define _BENAPHORE_H
15 typedef struct {
16 sem_id sem;
17 int32 ben;
18 } benaphore;
21 #define INIT_BEN(x, prefix) ( (x).ben = 0, (x).sem = create_sem(0, #prefix " benaphore"), (x).sem )
22 #define ACQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
23 #define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
24 #define DELETE_BEN(x) delete_sem(x.sem);
26 #endif