#include <string.h>
#include <ctype.h>
#include <stdarg.h>
-
+#include <pthread.h>
#include <sys/types.h>
#include <dirent.h>
int size;
mlt_properties mirror;
int ref_count;
+ pthread_mutex_t mutex;
}
property_list;
// Increment the ref count
( ( property_list * )this->local )->ref_count = 1;
+ pthread_mutex_init( &( ( property_list * )this->local )->mutex, NULL );;
}
// Check that initialisation was successful
int mlt_properties_inc_ref( mlt_properties this )
{
+ int result = 0;
if ( this != NULL )
{
property_list *list = this->local;
- return ++ list->ref_count;
+ pthread_mutex_lock( &list->mutex );
+ result = ++ list->ref_count;
+ pthread_mutex_unlock( &list->mutex );
}
- return 0;
+ return result;
}
/** Maintain ref count to allow multiple uses of an mlt object.
int mlt_properties_dec_ref( mlt_properties this )
{
+ int result = 0;
if ( this != NULL )
{
property_list *list = this->local;
- return -- list->ref_count;
+ pthread_mutex_lock( &list->mutex );
+ result = -- list->ref_count;
+ pthread_mutex_unlock( &list->mutex );
}
- return 0;
+ return result;
}
/** Return the ref count of this object.
}
// Clear up the list
+ pthread_mutex_destroy( &list->mutex );
free( list->name );
free( list->value );
free( list );
// Increment the reference count on this producer
if ( producer != NULL )
- {
- mlt_service_lock( producer );
mlt_properties_inc_ref( MLT_SERVICE_PROPERTIES( producer ) );
- mlt_service_unlock( producer );
- }
// Now we disconnect the producer service from its consumer
mlt_service_disconnect( producer );
void mlt_service_close( mlt_service this )
{
- mlt_service_lock( this );
if ( this != NULL && mlt_properties_dec_ref( MLT_SERVICE_PROPERTIES( this ) ) <= 0 )
{
- mlt_service_unlock( this );
if ( this->close != NULL )
{
this->close( this->close_object );