renamed locking.* to condition.*
This commit is contained in:
parent
ffdc06d98f
commit
0d1097315c
5 changed files with 79 additions and 14 deletions
|
|
@ -26,7 +26,7 @@ libcin3_a_SOURCES = \
|
|||
$(libcin3_a_srcdir)/error.c \
|
||||
$(libcin3_a_srcdir)/time.c \
|
||||
$(libcin3_a_srcdir)/framerate.c \
|
||||
$(libcin3_a_srcdir)/locking.c
|
||||
$(libcin3_a_srcdir)/condition.c
|
||||
|
||||
|
||||
noinst_HEADERS += \
|
||||
|
|
@ -34,5 +34,5 @@ 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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
locking.c - locking primitives
|
||||
condition.c - condition variable
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "lib/locking.h"
|
||||
#include "lib/condition.h"
|
||||
|
||||
CinelerraCondition
|
||||
cinelerra_condition_init (CinelerraCondition self)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
locking.h - locking primitives
|
||||
condition.h - condition variables
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
|
@ -19,8 +19,8 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef CINELERRA_LOCKING_H
|
||||
#define CINELERRA_LOCKING_H
|
||||
#ifndef CINELERRA_CONDITION_H
|
||||
#define CINELERRA_CONDITION_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include <nobug.h>
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
enum cinelerra_lockstate
|
||||
enum cinelerra_conditionstate
|
||||
{
|
||||
CINELERRA_UNLOCKED,
|
||||
CINELERRA_LOCKED
|
||||
|
|
@ -110,7 +110,7 @@ cinelerra_condition_broadcast (CinelerraCondition self)
|
|||
struct cinelerra_conditionlock_struct
|
||||
{
|
||||
CinelerraCondition cond;
|
||||
enum cinelerra_lockstate state;
|
||||
enum cinelerra_conditionstate state;
|
||||
};
|
||||
typedef struct cinelerra_conditionlock_struct cinelerra_conditionlock;
|
||||
typedef struct cinelerra_conditionlock_struct* CinelerraConditionlock;
|
||||
|
|
@ -136,7 +136,7 @@ cinelerra_conditionlock NOBUG_CLEANUP(cinelerra_conditionlock_ensureunlocked)
|
|||
* errors are fatal
|
||||
*/
|
||||
static inline CinelerraConditionlock
|
||||
cinelerra_conditionlock_init (CinelerraConditionlock self, CinelerraCondition cond, enum cinelerra_lockstate state)
|
||||
cinelerra_conditionlock_init (CinelerraConditionlock self, CinelerraCondition cond, enum cinelerra_conditionstate state)
|
||||
{
|
||||
REQUIRE (self);
|
||||
REQUIRE (cond);
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
tests_srcdir = $(top_srcdir)/tests
|
||||
|
||||
check_PROGRAMS += test-error test-time test-locking
|
||||
check_PROGRAMS += test-error test-time test-condition
|
||||
|
||||
test_error_SOURCES = $(tests_srcdir)/error/errortest.c
|
||||
test_error_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||
|
|
@ -28,8 +28,8 @@ test_time_SOURCES = $(tests_srcdir)/time/test-time.c
|
|||
test_time_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||
test_time_LDADD = $(builddir)/libcin3.a -lnobugmt -lpthread -ldl -lm
|
||||
|
||||
test_locking_SOURCES = $(tests_srcdir)/locking/test-locking.c
|
||||
test_locking_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||
test_locking_LDADD = $(builddir)/libcin3.a -lnobugmt -lpthread -ldl -lm
|
||||
test_condition_SOURCES = $(tests_srcdir)/locking/test-condition.c
|
||||
test_condition_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||
test_condition_LDADD = $(builddir)/libcin3.a -lnobugmt -lpthread -ldl -lm
|
||||
|
||||
TESTS = $(tests_srcdir)/test.sh
|
||||
|
|
|
|||
65
tests/locking/test-condition.c
Normal file
65
tests/locking/test-condition.c
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
test-locking.c - test locking functions
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lib/condition.h"
|
||||
|
||||
CINELERRA_ERROR_DEFINE(TEST, "test error");
|
||||
|
||||
#if 0
|
||||
waiting_thread()
|
||||
{
|
||||
lock;
|
||||
wait;
|
||||
unlock;
|
||||
}
|
||||
|
||||
|
||||
signaling_thread()
|
||||
{
|
||||
signal();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char** argv)
|
||||
{
|
||||
NOBUG_INIT;
|
||||
|
||||
if (argc == 1)
|
||||
return 0;
|
||||
|
||||
if (!strcmp(argv[1], "conditionforgotunlock"))
|
||||
{
|
||||
cinelerra_condition c;
|
||||
cinelerra_condition_init (&c);
|
||||
|
||||
cinelerra_conditionlock NOBUG_CLEANUP(cinelerra_conditionlock_ensureunlocked) l;
|
||||
cinelerra_conditionlock_init (&l, &c, CINELERRA_LOCKED);
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in a new issue