I've noticed this library uses gevent for essentially context switching on blocking threads but its not clear how you can go about implementing a blocking system call that needs to return a value. Only examples of gevent being used is for yielding and sleeping but im currently having an issue where the emulation gets deadlocked on a newselect system call.
I have tried to use gevent's monkey patching but it seems to cause issues maybe with unicorn that causes crashes on some random pointer deref.
Also if a single thread tries to use gevent on a select call that waits infinitely it will not hand control to another thread and complain about it would loop forever?
I have managed to do a ghetto fix by making the infinitely waiting select a finite time and then using the same code as sleep to pause that thread for some time to hand control back over to the main thread but its not ideal.
Just looking for a bit of info or example how i could implement this.
I've noticed this library uses gevent for essentially context switching on blocking threads but its not clear how you can go about implementing a blocking system call that needs to return a value. Only examples of gevent being used is for yielding and sleeping but im currently having an issue where the emulation gets deadlocked on a newselect system call.
I have tried to use gevent's monkey patching but it seems to cause issues maybe with unicorn that causes crashes on some random pointer deref.
Also if a single thread tries to use gevent on a select call that waits infinitely it will not hand control to another thread and complain about it would loop forever?
I have managed to do a ghetto fix by making the infinitely waiting select a finite time and then using the same code as sleep to pause that thread for some time to hand control back over to the main thread but its not ideal.
Just looking for a bit of info or example how i could implement this.