From 7445c1798d267cea66411453ea07a80f94cd9c31 Mon Sep 17 00:00:00 2001 From: Christian Thaeter Date: Sun, 2 Sep 2007 16:19:50 +0200 Subject: [PATCH] generic locking.h for shared declarations --- src/lib/Makefile.am | 1 + src/lib/condition.h | 20 +++----------------- src/lib/locking.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 src/lib/locking.h diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 0256ca2ea..320a579c2 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -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 diff --git a/src/lib/condition.h b/src/lib/condition.h index 60714ed9f..7efad439c 100644 --- a/src/lib/condition.h +++ b/src/lib/condition.h @@ -22,21 +22,7 @@ #ifndef CINELERRA_CONDITION_H #define CINELERRA_CONDITION_H -#include -#include - -#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); diff --git a/src/lib/locking.h b/src/lib/locking.h new file mode 100644 index 000000000..aa722a568 --- /dev/null +++ b/src/lib/locking.h @@ -0,0 +1,43 @@ +/* + locking.h - shared declarations for all locking primitives + + Copyright (C) CinelerraCV + 2007, Christian Thaeter + + 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 +#include + +#include "lib/error.h" + +/** + * used to store the current lock state. + * + * + */ +enum cinelerra_lockstate + { + CINELERRA_UNLOCKED, + CINELERRA_LOCKED, + CINELERRA_RLOCKED, + CINELERRA_WLOCKED + }; + +#endif