added moo_purgesemiosbyhandle()

This commit is contained in:
hyunghwan.chung
2018-02-03 07:16:29 +00:00
parent ea70db9633
commit eb35c3d865
4 changed files with 39 additions and 1 deletions

View File

@ -1341,6 +1341,34 @@ static int delete_from_sem_io (moo_t* moo, moo_oop_semaphore_t sem, int force)
return 0;
}
void moo_purgesemiosbyhandle (moo_t* moo, moo_ooi_t io_handle)
{
moo_ooi_t index;
moo_oop_semaphore_t sem;
if (io_handle < moo->sem_io_map_capa)
{
index = moo->sem_io_map[io_handle];
if (index >= 0)
{
MOO_ASSERT(moo, moo->sem_io_tuple[index].handle == io_handle);
sem = moo->sem_io_tuple[index].sem[MOO_SEMAPHORE_IO_TYPE_INPUT];
if (sem) delete_from_sem_io (moo, sem, 0);
}
}
if (io_handle < moo->sem_io_map_capa)
{
index = moo->sem_io_map[io_handle];
if (index >= 0)
{
MOO_ASSERT(moo, moo->sem_io_tuple[index].handle == io_handle);
sem = moo->sem_io_tuple[index].sem[MOO_SEMAPHORE_IO_TYPE_OUTPUT];
if (sem) delete_from_sem_io (moo, sem, 0);
}
}
}
static void _signal_io_semaphore (moo_t* moo, moo_oop_semaphore_t sem)
{
moo_oop_process_t proc;