// CLASS HEADER
#include <dali/devel-api/threading/conditional-wait.h>
-// INTERNAL INCLUDES
-#include <dali/internal/common/mutex-impl.h>
-
// EXTERNAL INCLUDES
#include <pthread.h>
+
+// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
+#include <dali/internal/common/mutex-impl.h>
namespace Dali
{
ConditionalWait::ConditionalWait()
: mImpl( new ConditionalWaitImpl )
{
- pthread_mutex_init( &mImpl->mutex, NULL );
- pthread_cond_init( &mImpl->condition, NULL );
+ if( pthread_mutex_init( &mImpl->mutex, NULL ) )
+ {
+ DALI_LOG_ERROR( "Unable to initialise mutex in ConditionalWait" );
+ }
+ if( pthread_cond_init( &mImpl->condition, NULL ) )
+ {
+ DALI_LOG_ERROR( "Unable to initialise conditional" );
+ }
mImpl->count = 0;
}
ConditionalWait::~ConditionalWait()
{
- pthread_cond_destroy( &mImpl->condition );
- pthread_mutex_destroy( &mImpl->mutex );
+ if( pthread_cond_destroy( &mImpl->condition ) )
+ {
+ DALI_LOG_ERROR( "Unable to destroy conditional" );
+ }
+ if( pthread_mutex_destroy( &mImpl->mutex ) )
+ {
+ DALI_LOG_ERROR( "Unable to destroy mutex in ConditionalWait" );
+ }
delete mImpl;
}
// broadcast all threads to continue
if( 0 != previousCount )
{
- pthread_cond_broadcast( &mImpl->condition );
+ if( pthread_cond_broadcast( &mImpl->condition ) )
+ {
+ DALI_LOG_ERROR( "Error calling pthread_cond_broadcast" );
+ }
}
Internal::Mutex::Unlock( &mImpl->mutex );
}
// broadcast all threads to continue
if( 0 != previousCount )
{
- pthread_cond_broadcast( &mImpl->condition );
+ if( pthread_cond_broadcast( &mImpl->condition ) )
+ {
+ DALI_LOG_ERROR( "Error calling pthread_cond_broadcast" );
+ }
}
}
do
{
// wait while condition changes
- pthread_cond_wait( &mImpl->condition, &mImpl->mutex ); // releases the lock whilst waiting
+ if( pthread_cond_wait( &mImpl->condition, &mImpl->mutex ) ) // releases the lock whilst waiting
+ {
+ DALI_LOG_ERROR( "Error calling pthread_cond_wait" );
+ break;
+ }
}
while( 0 != mImpl->count );
// when condition returns the mutex is locked so release the lock
do
{
// wait while condition changes
- pthread_cond_wait( &mImpl->condition, &mImpl->mutex ); // releases the lock whilst waiting
+ if( pthread_cond_wait( &mImpl->condition, &mImpl->mutex ) ) // releases the lock whilst waiting
+ {
+ DALI_LOG_ERROR( "Error calling pthread_cond_wait" );
+ break;
+ }
}
while( 0 != mImpl->count );
// CLASS HEADER
#include <dali/devel-api/threading/mutex.h>
-// INTERNAL INCLUDES
-#include <dali/internal/common/mutex-impl.h>
-
// EXTERNAL INCLUDES
#include <pthread.h>
+// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/internal/common/mutex-impl.h>
+
namespace Dali
{
Mutex::Mutex()
: mImpl( new MutexImpl )
{
- pthread_mutex_init( &mImpl->mutex, NULL );
+ if( pthread_mutex_init( &mImpl->mutex, NULL ) )
+ {
+ DALI_LOG_ERROR( "Unable to initialise Mutex" );
+ }
mImpl->locked = false;
}
Mutex::~Mutex()
{
- pthread_mutex_destroy( &mImpl->mutex );
+ if( pthread_mutex_destroy( &mImpl->mutex ) )
+ {
+ DALI_LOG_ERROR( "Unable to destroy Mutex" );
+ }
// nothing else to do as there is no Lock/Unlock API
// ScopedLock destructor will always unlock the mutex
delete mImpl;
ScalingMode scaling : 3; ///< scaling option, ShrinkToFit is default
FilterMode filtering : 3; ///< filtering option. Box is the default
bool mOrientationCorrection : 1; ///< If true, image pixels are reordered according to orientation metadata on load.
- bool isDistanceField : 1; ///< true, if the image is a distancefield. Default is false.
};
*/
bool operator<(const ImageAttributes& a, const ImageAttributes& b)
{
- // Bail out if one is distance field and the other is not.
- if (a.impl->isDistanceField != b.impl->isDistanceField)
- {
- return a.impl->isDistanceField < b.impl->isDistanceField;
- }
-
if (a.impl->width != b.impl->width)
{
return a.impl->width < b.impl->width;
#endif // LOCK_BACKTRACE_ENABLED
+// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
namespace Dali
{
#ifdef LOCK_BACKTRACE_ENABLED
#endif // LOCK_BACKTRACE_ENABLED
- pthread_mutex_lock( mutex );
+ if( pthread_mutex_lock( mutex ) )
+ {
+ DALI_LOG_ERROR( "Error calling pthread_mutex_lock" );
+ }
}
void Unlock( pthread_mutex_t* mutex )
{
- pthread_mutex_unlock( mutex );
+ if( pthread_mutex_unlock( mutex ) )
+ {
+ DALI_LOG_ERROR( "Error calling pthread_mutex_unlock" );
+ }
--gThreadLockCount;
}