forked from enlightenment/efl
eina thread queue/semaphores - check even more unlikely errors + complain
check some really unlikely alloc errors and semaphore deadlock errors and report if that has happened. just in case.
This commit is contained in:
parent
07924f26f1
commit
8fd224b4d6
|
@ -888,7 +888,11 @@ eina_semaphore_lock(Eina_Semaphore *sem)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
break;
|
{
|
||||||
|
if (errno == EDEADLK)
|
||||||
|
EINA_LOCK_DEADLOCK_DEBUG(sem_wait, sem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
|
|
@ -116,7 +116,11 @@ _eina_thread_queue_msg_block_new(int size)
|
||||||
blk = malloc(sizeof(Eina_Thread_Queue_Msg_Block) -
|
blk = malloc(sizeof(Eina_Thread_Queue_Msg_Block) -
|
||||||
sizeof(Eina_Thread_Queue_Msg) +
|
sizeof(Eina_Thread_Queue_Msg) +
|
||||||
size);
|
size);
|
||||||
if (!blk) return NULL;
|
if (!blk)
|
||||||
|
{
|
||||||
|
ERR("Thread queue block buffer of size %i allocation failed", size);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
blk->next = NULL;
|
blk->next = NULL;
|
||||||
#ifndef ATOMIC
|
#ifndef ATOMIC
|
||||||
eina_spinlock_new(&(blk->lock_ref));
|
eina_spinlock_new(&(blk->lock_ref));
|
||||||
|
@ -380,7 +384,11 @@ eina_thread_queue_new(void)
|
||||||
Eina_Thread_Queue *thq;
|
Eina_Thread_Queue *thq;
|
||||||
|
|
||||||
thq = calloc(1, sizeof(Eina_Thread_Queue));
|
thq = calloc(1, sizeof(Eina_Thread_Queue));
|
||||||
if (!thq) return NULL;
|
if (!thq)
|
||||||
|
{
|
||||||
|
ERR("Allocation of Thread queue structure failed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
thq->fd = -1;
|
thq->fd = -1;
|
||||||
if (!eina_semaphore_new(&(thq->sem), 0))
|
if (!eina_semaphore_new(&(thq->sem), 0))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue