X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmvcp%2Fmvcp_notifier.c;h=189be9ddcb091abe3a0598e55759f91fb64851a0;hb=44374162573c8026c0e4541353833a18235e163e;hp=5e34043724cc2242422f8e1da0adde42ac0aea1d;hpb=27f0329aa8f434794f1f18e018fc3221e58b77a4;p=melted diff --git a/src/mvcp/mvcp_notifier.c b/src/mvcp/mvcp_notifier.c index 5e34043..189be9d 100644 --- a/src/mvcp/mvcp_notifier.c +++ b/src/mvcp/mvcp_notifier.c @@ -1,6 +1,6 @@ /* - * valerie_notifier.c -- Unit Status Notifier Handling - * Copyright (C) 2002-2003 Ushodaya Enterprises Limited + * mvcp_notifier.c -- Unit Status Notifier Handling + * Copyright (C) 2002-2009 Ushodaya Enterprises Limited * Author: Charles Yates * * This library is free software; you can redistribute it and/or @@ -30,14 +30,14 @@ #include /* Application header files */ -#include "valerie_notifier.h" +#include "mvcp_notifier.h" /** Notifier initialisation. */ -valerie_notifier valerie_notifier_init( ) +mvcp_notifier mvcp_notifier_init( ) { - valerie_notifier this = calloc( 1, sizeof( valerie_notifier_t ) ); + mvcp_notifier this = calloc( 1, sizeof( mvcp_notifier_t ) ); if ( this != NULL ) { int index = 0; @@ -52,13 +52,13 @@ valerie_notifier valerie_notifier_init( ) /** Get a stored status for the specified unit. */ -void valerie_notifier_get( valerie_notifier this, valerie_status status, int unit ) +void mvcp_notifier_get( mvcp_notifier this, mvcp_status status, int unit ) { pthread_mutex_lock( &this->mutex ); if ( unit >= 0 && unit < MAX_UNITS ) - valerie_status_copy( status, &this->store[ unit ] ); + mvcp_status_copy( status, &this->store[ unit ] ); else - memset( status, 0, sizeof( valerie_status_t ) ); + memset( status, 0, sizeof( mvcp_status_t ) ); status->unit = unit; status->dummy = time( NULL ); pthread_mutex_unlock( &this->mutex ); @@ -67,19 +67,19 @@ void valerie_notifier_get( valerie_notifier this, valerie_status status, int uni /** Wait on a new status. */ -int valerie_notifier_wait( valerie_notifier this, valerie_status status ) +int mvcp_notifier_wait( mvcp_notifier this, mvcp_status status ) { struct timeval now; struct timespec timeout; int error = 0; - memset( status, 0, sizeof( valerie_status_t ) ); + memset( status, 0, sizeof( mvcp_status_t ) ); gettimeofday( &now, NULL ); timeout.tv_sec = now.tv_sec + 1; timeout.tv_nsec = now.tv_usec * 1000; pthread_mutex_lock( &this->mutex ); pthread_cond_timedwait( &this->cond, &this->mutex, &timeout ); - valerie_status_copy( status, &this->last ); + mvcp_status_copy( status, &this->last ); pthread_mutex_unlock( &this->mutex ); return error; @@ -88,11 +88,11 @@ int valerie_notifier_wait( valerie_notifier this, valerie_status status ) /** Put a new status. */ -void valerie_notifier_put( valerie_notifier this, valerie_status status ) +void mvcp_notifier_put( mvcp_notifier this, mvcp_status status ) { pthread_mutex_lock( &this->mutex ); - valerie_status_copy( &this->store[ status->unit ], status ); - valerie_status_copy( &this->last, status ); + mvcp_status_copy( &this->store[ status->unit ], status ); + mvcp_status_copy( &this->last, status ); pthread_mutex_unlock( &this->mutex ); pthread_cond_broadcast( &this->cond ); } @@ -100,22 +100,22 @@ void valerie_notifier_put( valerie_notifier this, valerie_status status ) /** Communicate a disconnected status for all units to all waiting. */ -void valerie_notifier_disconnected( valerie_notifier notifier ) +void mvcp_notifier_disconnected( mvcp_notifier notifier ) { int unit = 0; - valerie_status_t status; + mvcp_status_t status; for ( unit = 0; unit < MAX_UNITS; unit ++ ) { - valerie_notifier_get( notifier, &status, unit ); + mvcp_notifier_get( notifier, &status, unit ); status.status = unit_disconnected; - valerie_notifier_put( notifier, &status ); + mvcp_notifier_put( notifier, &status ); } } /** Close the notifier - note that all access must be stopped before we call this. */ -void valerie_notifier_close( valerie_notifier this ) +void mvcp_notifier_close( mvcp_notifier this ) { if ( this != NULL ) {