debugging semaphore handling

This commit is contained in:
hyunghwan.chung 2019-08-30 08:42:21 +00:00
parent 584e7f121e
commit d9ad1a7804

View File

@ -620,7 +620,7 @@ static void terminate_process (moo_t* moo, moo_oop_process_t proc)
if (MOO_OOP_TO_SMOOI(moo->processor->runnable.count) > 0) if (MOO_OOP_TO_SMOOI(moo->processor->runnable.count) > 0)
{ {
moo_oop_process_t p; moo_oop_process_t p;
MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "Runnable: "); MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "Runnable:");
p = moo->processor->runnable.first; p = moo->processor->runnable.first;
while (p) while (p)
{ {
@ -633,7 +633,7 @@ static void terminate_process (moo_t* moo, moo_oop_process_t proc)
if (MOO_OOP_TO_SMOOI(moo->processor->suspended.count) > 0) if (MOO_OOP_TO_SMOOI(moo->processor->suspended.count) > 0)
{ {
moo_oop_process_t p; moo_oop_process_t p;
MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "Suspended: "); MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "Suspended:");
p = moo->processor->suspended.first; p = moo->processor->suspended.first;
while (p) while (p)
{ {
@ -643,6 +643,20 @@ static void terminate_process (moo_t* moo, moo_oop_process_t proc)
} }
MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "\n"); MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "\n");
} }
if (moo->sem_io_wait_count > 0)
{
moo_ooi_t io_handle;
MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "IO Semaphores:");
for (io_handle = 0; io_handle < moo->sem_io_map_capa; io_handle++)
{
if (moo->sem_io_map[io_handle] >= 0)
{
MOO_LOG1 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, " %zd", io_handle);
}
}
MOO_LOG0 (moo, MOO_LOG_IC | MOO_LOG_DEBUG, "\n");
}
} }
else else
{ {
@ -1381,6 +1395,15 @@ static int delete_sem_from_sem_io_tuple (moo_t* moo, moo_oop_semaphore_t sem, in
sem->u.io.type = moo->_nil; sem->u.io.type = moo->_nil;
moo->sem_io_count--; moo->sem_io_count--;
/* ****************************************** */
if (sem->waiting.first != moo->_nil)
{
/* TODO: debug further.... */
MOO_DEBUG1 (moo, "decrementing 44 seio_io_wait_count. IO %zd\n", io_handle);
moo->sem_io_wait_count--;
}
/* ****************************************** */
if ((moo_oop_t)sem->group != moo->_nil) if ((moo_oop_t)sem->group != moo->_nil)
{ {
moo_ooi_t count; moo_ooi_t count;