mlt_events events = mlt_events_fetch( self );
if ( events == NULL )
{
- events = malloc( sizeof( struct mlt_events_struct ) );
+ events = calloc( 1, sizeof( struct mlt_events_struct ) );
events->list = mlt_properties_new( );
mlt_events_store( self, events );
}
typedef struct
{
- int done;
pthread_cond_t cond;
pthread_mutex_t mutex;
}
static void mlt_events_listen_for( mlt_properties self, condition_pair *pair )
{
pthread_mutex_lock( &pair->mutex );
- if ( pair->done == 0 )
- {
- pthread_cond_signal( &pair->cond );
- pthread_mutex_unlock( &pair->mutex );
- }
+ pthread_cond_signal( &pair->cond );
+ pthread_mutex_unlock( &pair->mutex );
}
/** Prepare to wait for an event.
mlt_event mlt_events_setup_wait_for( mlt_properties self, const char *id )
{
condition_pair *pair = malloc( sizeof( condition_pair ) );
- pair->done = 0;
pthread_cond_init( &pair->cond, NULL );
pthread_mutex_init( &pair->mutex, NULL );
pthread_mutex_lock( &pair->mutex );
{
condition_pair *pair = event->service;
event->owner = NULL;
- pair->done = 0;
pthread_mutex_unlock( &pair->mutex );
pthread_mutex_destroy( &pair->mutex );
pthread_cond_destroy( &pair->cond );
+ free( pair );
}
}