forked from enlightenment/efl
parent
a4b92a0c69
commit
bc0e734f93
|
@ -93,3 +93,7 @@
|
|||
2011-05-24 Cedric Bail
|
||||
|
||||
* Add eina_inlist_sorted_insert.
|
||||
|
||||
2011-05-30 Cedric Bail
|
||||
|
||||
* Add eina_condition_timedwait.
|
||||
|
|
|
@ -310,7 +310,27 @@ eina_condition_wait(Eina_Condition *cond)
|
|||
assert(cond->lock != NULL);
|
||||
#endif
|
||||
|
||||
return pthread_cond_wait(&(cond->condition), &(cond->lock->mutex)) == 0 ? EINA_TRUE : EINA_FALSE;
|
||||
return pthread_cond_wait(&(cond->condition),
|
||||
&(cond->lock->mutex)) == 0 ? EINA_TRUE : EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_timedwait(Eina_Condition *cond, double t)
|
||||
{
|
||||
struct timespec tv;
|
||||
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(_eina_threads_activated);
|
||||
assert(cond->lock != NULL);
|
||||
#endif
|
||||
|
||||
tv.tv_sec = t;
|
||||
tv.tv_nsec = (t - (double) tv.tv_sec) * 1000000000;
|
||||
|
||||
return pthread_cond_timedwait(&(cond->condition),
|
||||
&(cond->lock->mutex),
|
||||
&tv) == 0 ?
|
||||
EINA_TRUE : EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
|
|
|
@ -155,6 +155,12 @@ eina_condition_wait(Eina_Condition *cond EINA_UNUSED)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_timedwait(Eina_Condition *cond EINA_UNUSED, double val)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_broadcast(Eina_Condition *cond EINA_UNUSED)
|
||||
{
|
||||
|
|
|
@ -144,7 +144,7 @@ eina_condition_free(Eina_Condition *cond)
|
|||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_wait(Eina_Condition *cond)
|
||||
_eina_condition_internal_timedwait(Eina_Condition *cond, DWORD t)
|
||||
{
|
||||
#if _WIN32_WINNT >= 0x0600
|
||||
SleepConditionVariableCS(&cond->condition, cond->mutex, INFINITE);
|
||||
|
@ -162,7 +162,7 @@ eina_condition_wait(Eina_Condition *cond)
|
|||
* semaphore until <pthread_cond_signal> or <pthread_cond_broadcast>
|
||||
* are called by another thread.
|
||||
*/
|
||||
ret = SignalObjectAndWait(cond->mutex, cond->semaphore, INFINITE, FALSE);
|
||||
ret = SignalObjectAndWait(cond->mutex, cond->semaphore, t, FALSE);
|
||||
if (ret == WAIT_FAILED)
|
||||
return EINA_FALSE;
|
||||
|
||||
|
@ -187,7 +187,7 @@ eina_condition_wait(Eina_Condition *cond)
|
|||
* This call atomically signals the <waiters_done_> event and waits until
|
||||
* it can acquire the <external_mutex>. This is required to ensure fairness.
|
||||
*/
|
||||
ret = SignalObjectAndWait(cond->waiters_done, cond->mutex, INFINITE, FALSE);
|
||||
ret = SignalObjectAndWait(cond->waiters_done, cond->mutex, t, FALSE);
|
||||
if (ret == WAIT_FAILED)
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ eina_condition_wait(Eina_Condition *cond)
|
|||
* Always regain the external mutex since that's the guarantee we
|
||||
* give to our callers.
|
||||
*/
|
||||
ret = WaitForSingleObject(cond->mutex, INFINITE);
|
||||
ret = WaitForSingleObject(cond->mutex, t);
|
||||
if (ret == WAIT_FAILED)
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
@ -206,6 +206,18 @@ eina_condition_wait(Eina_Condition *cond)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_timedwait(Eina_Condition *cond, double val)
|
||||
{
|
||||
_eina_condition_internal_timedwait(cond, val * 1000);
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_wait(Eina_Condition *cond)
|
||||
{
|
||||
_eina_condition_internal_timedwait(cond, INFINITE);
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_broadcast(Eina_Condition *cond)
|
||||
{
|
||||
|
|
|
@ -95,6 +95,12 @@ eina_condition_wait(Eina_Condition *cond)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_timedwait(Eina_Condition *cond, double t)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_broadcast(Eina_Condition *cond)
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ static inline void eina_lock_debug(const Eina_Lock *mutex);
|
|||
static inline Eina_Bool eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex);
|
||||
static inline void eina_condition_free(Eina_Condition *cond);
|
||||
static inline Eina_Bool eina_condition_wait(Eina_Condition *cond);
|
||||
static inline Eina_Bool eina_condition_timedwait(Eina_Condition *cond, double t);
|
||||
static inline Eina_Bool eina_condition_broadcast(Eina_Condition *cond);
|
||||
static inline Eina_Bool eina_condition_signal(Eina_Condition *cond);
|
||||
|
||||
|
|
Loading…
Reference in New Issue