some code clean and adding one more kill point for halted devices
This commit is contained in:
parent
5a05a6e9cd
commit
d36a148703
@ -733,6 +733,17 @@ static void clear_unneeded_cfmbs (mio_t* mio)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void kill_all_halted_devices (mio_t* mio)
|
||||||
|
{
|
||||||
|
/* kill all halted devices */
|
||||||
|
while (!MIO_DEVL_IS_EMPTY(&mio->hltdev))
|
||||||
|
{
|
||||||
|
mio_dev_t* dev = MIO_DEVL_FIRST_DEV(&mio->hltdev);
|
||||||
|
MIO_DEBUG1 (mio, "MIO - Killing HALTED device %p\n", dev);
|
||||||
|
mio_dev_kill (dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int mio_exec (mio_t* mio)
|
int mio_exec (mio_t* mio)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -757,6 +768,8 @@ int mio_exec (mio_t* mio)
|
|||||||
/* wait on the multiplexer only if there is at least 1 active device */
|
/* wait on the multiplexer only if there is at least 1 active device */
|
||||||
mio_ntime_t tmout;
|
mio_ntime_t tmout;
|
||||||
|
|
||||||
|
kill_all_halted_devices (mio);
|
||||||
|
|
||||||
if (mio_gettmrtmout(mio, MIO_NULL, &tmout) <= 0)
|
if (mio_gettmrtmout(mio, MIO_NULL, &tmout) <= 0)
|
||||||
{
|
{
|
||||||
/* defaults to 0 or 1 second if timeout can't be acquired.
|
/* defaults to 0 or 1 second if timeout can't be acquired.
|
||||||
@ -773,14 +786,7 @@ int mio_exec (mio_t* mio)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* kill all halted devices */
|
kill_all_halted_devices (mio);
|
||||||
while (!MIO_DEVL_IS_EMPTY(&mio->hltdev))
|
|
||||||
{
|
|
||||||
mio_dev_t* dev = MIO_DEVL_FIRST_DEV(&mio->hltdev);
|
|
||||||
MIO_DEBUG1 (mio, "MIO - Killing HALTED device %p\n", dev);
|
|
||||||
mio_dev_kill (dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ mio_tmridx_t mio_updtmrjob (mio_t* mio, mio_tmridx_t index, const mio_tmrjob_t*
|
|||||||
item = mio->tmr.jobs[index];
|
item = mio->tmr.jobs[index];
|
||||||
mio->tmr.jobs[index] = *job;
|
mio->tmr.jobs[index] = *job;
|
||||||
if (mio->tmr.jobs[index].idxptr) *mio->tmr.jobs[index].idxptr = index;
|
if (mio->tmr.jobs[index].idxptr) *mio->tmr.jobs[index].idxptr = index;
|
||||||
return YOUNGER_THAN(job, &item)? sift_up (mio, index): sift_down (mio, index);
|
return YOUNGER_THAN(job, &item)? sift_up(mio, index): sift_down(mio, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mio_firetmrjobs (mio_t* mio, const mio_ntime_t* tm, mio_oow_t* firecnt)
|
void mio_firetmrjobs (mio_t* mio, const mio_ntime_t* tm, mio_oow_t* firecnt)
|
||||||
|
Loading…
Reference in New Issue
Block a user