[Vm-dev] Tasks of the heartbeat code

Holger Freyther holger at freyther.de
Fri Jan 1 10:33:31 UTC 2016

> On 25 Dec 2015, at 21:40, Holger Freyther <holger at freyther.de> wrote:

Dear Eliot,

> -	if (((now = ioUTCMicroseconds())) >= GIV(nextPollUsecs)) {
> +
> +	if (doDispatch) {
> +		doDispatch = 0;
> 		GIV(statIOProcessEvents) += 1;
> 		ioProcessEvents();
> -
> -		/* msecs to wait before next call to ioProcessEvents.  Note that strictly
> -		   speaking we might need to update 'now' at this point since
> -		   ioProcessEvents could take a very long time on some platforms */
> -		GIV(nextPollUsecs) = now + 20000;
> 	}
> +	now = ioUTCMicroseconds();
> 	if (GIV(interruptPending)) {

could you please help me with getting the above right and help me to get it into the
VMMaker? I wonder which atomic interface to use between the aioPoll code and
the VMMaker without breaking the Windows/OSX build right now.

1.) I think I don't want the time based polling but only if something has happened

2.) In the SIGIO signal handler I will need to register an event. I'm wondering if I
want to use:
	__sync_fetch_and_add 	to count the number of SIGIOs not handled?
	otherwise the classic loop with __sync_bool_compare_and_swap?

3.) In the VMMaker and only if the SIGIO interface is present. I think I need to use
sqCompareAndSwap to try to read the number of events?

4.) Which variables (and addresses) can be used and where would I keep them?

kind regards

More information about the Vm-dev mailing list