generic locking.h for shared declarations

This commit is contained in:
Christian Thaeter 2007-09-02 16:19:50 +02:00
parent dd67216f38
commit 7445c1798d
3 changed files with 47 additions and 17 deletions

View file

@ -34,5 +34,6 @@ noinst_HEADERS += \
$(libcin3_a_srcdir)/error.h \
$(libcin3_a_srcdir)/time.h \
$(libcin3_a_srcdir)/framerate.h \
$(libcin3_a_srcdir)/locking.h \
$(libcin3_a_srcdir)/condition.h

View file

@ -22,21 +22,7 @@
#ifndef CINELERRA_CONDITION_H
#define CINELERRA_CONDITION_H
#include <pthread.h>
#include <nobug.h>
#include "lib/error.h"
/**
* used to store the current lock state.
*
*
*/
enum cinelerra_conditionstate
{
CINELERRA_UNLOCKED,
CINELERRA_LOCKED
};
#include "lib/locking.h"
/**
@ -110,7 +96,7 @@ cinelerra_condition_broadcast (CinelerraCondition self)
struct cinelerra_conditionlock_struct
{
CinelerraCondition cond;
enum cinelerra_conditionstate state;
enum cinelerra_lockstate state;
};
typedef struct cinelerra_conditionlock_struct cinelerra_conditionlock;
typedef struct cinelerra_conditionlock_struct* CinelerraConditionlock;
@ -136,7 +122,7 @@ cinelerra_conditionlock NOBUG_CLEANUP(cinelerra_conditionlock_ensureunlocked)
* errors are fatal
*/
static inline CinelerraConditionlock
cinelerra_conditionlock_init (CinelerraConditionlock self, CinelerraCondition cond, enum cinelerra_conditionstate state)
cinelerra_conditionlock_init (CinelerraConditionlock self, CinelerraCondition cond, enum cinelerra_lockstate state)
{
REQUIRE (self);
REQUIRE (cond);

43
src/lib/locking.h Normal file
View file

@ -0,0 +1,43 @@
/*
locking.h - shared declarations for all locking primitives
Copyright (C) CinelerraCV
2007, Christian Thaeter <ct@pipapo.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef CINELERRA_LOCKING_H
#define CINELERRA_LOCKING_H
#include <pthread.h>
#include <nobug.h>
#include "lib/error.h"
/**
* used to store the current lock state.
*
*
*/
enum cinelerra_lockstate
{
CINELERRA_UNLOCKED,
CINELERRA_LOCKED,
CINELERRA_RLOCKED,
CINELERRA_WLOCKED
};
#endif