[Vm-dev] Android VM threaded

Michael Rueger lists at andience.co.nz
Mon Jun 26 07:51:59 UTC 2017

after a bit more digging it seems that the getRedzoneSize (sqUnixMain.c) magic doesn't work as expected in Android if it 
is called on a non-UI thread.
The behavior isn't consistent, it simply crashes or gives back impossibly large (negative) numbers.

Just for proof of concept I hard coded a value that I got from executing getRedzoneSize on the main thread and the VM 
now runs (I see regular calls to invalidate display in the log).

The code in that function is way over my head, so any help appreciated!

Discovered I need to sched_yield, otherwise the display is never updated even though draw is called from the UI thread 
after a VM initiated invalidate. Not handling actual display bits yet, hopefully really soon now :-)


static int
	struct sigaction handler_action, old;
	handler_action.sa_sigaction = sighandler;
	handler_action.sa_flags = SA_NODEFER | SA_SIGINFO;
	(void)sigaction(SIGPROF, &handler_action, &old);

	do kill(getpid(),SIGPROF); while (!p);
	(void)sigaction(SIGPROF, &old, 0);
	return (char *)min(&old,&handler_action) - sizeof(struct sigaction) - p;

More information about the Vm-dev mailing list