haiku/headers/private/graphics/common/benaphore.h
shadow303 8f6c61bcef Upgrade to version 4.1 of radeon driver.
Includes some common routines which may be used by other drivers.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8405 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-07-16 00:46:01 +00:00

27 lines
502 B
C

/*
Copyright (c) 2002, Thomas Kurschel
Part of Radeon driver
Benaphore definition
*/
#ifndef _BENAPHORE_H
#define _BENAPHORE_H
typedef struct {
sem_id sem;
int32 ben;
} benaphore;
#define INIT_BEN(x, prefix) ( (x).ben = 0, (x).sem = create_sem(0, #prefix " benaphore"), (x).sem )
#define ACQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
#define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
#define DELETE_BEN(x) delete_sem(x.sem);
#endif