fixed hio_loop() to check if there are scheduled timer jobs before breaking out of the loop

This commit is contained in:
hyung-hwan 2021-07-26 17:49:28 +00:00
parent d7e5ebdf4f
commit 56decb7174
2 changed files with 5 additions and 3 deletions

View File

@ -173,6 +173,7 @@ static void send_test_query (hio_t* hio, const hio_ntime_t* now, hio_tmrjob_t* j
hio_bch_t tmp[256];
int len;
HIO_INFO0 (hio, "ATTEMPTING TO SEND QUERY\n");
if (hio_svc_marc_querywithbchars(marc, 0, HIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, HIO_NULL) <= -1)
{
HIO_INFO1 (hio, "FAILED TO SEND QUERY - %js\n", hio_geterrmsg(hio));
@ -278,7 +279,7 @@ int main (int argc, char* argv[])
/* ---------------------------------------- */
{
hio_ntime_t x;
HIO_INIT_NTIME (&x, 32, 0);
HIO_INIT_NTIME (&x, 20, 0);
schedule_timer_job_after (hio, &x, send_test_query, marc);
hio_loop (hio);
}

View File

@ -942,7 +942,7 @@ void hio_stop (hio_t* hio, hio_stopreq_t stopreq)
hio_sys_intrmux (hio);
}
int hio_loop (hio_t* hio)
int hio_loop (hio_t* hio/*, int check_svc*/)
{
HIO_ASSERT (hio, (HIO_FEATURE_ALL & HIO_FEATURE_MUX)); /* never call this if you disableed this feature */
@ -952,7 +952,8 @@ int hio_loop (hio_t* hio)
if (hio_prologue(hio) <= -1) return -1;
while (hio->stopreq == HIO_STOPREQ_NONE && !HIO_DEVL_IS_EMPTY(&hio->actdev))
while (hio->stopreq == HIO_STOPREQ_NONE &&
(!HIO_DEVL_IS_EMPTY(&hio->actdev) || hio->tmr.size > 0))
{
if (__exec(hio) <= -1) break;
/* you can do other things here */