<div dir="ltr">Hi Eliot.<br><div class="gmail_extra"><br><div class="gmail_quote">2018-02-19 16:20 GMT+01:00 Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br><div dir="auto"><div>Hi Denis,<br><br></div><div><br>On Feb 19, 2018, at 6:35 AM, Denis Kudriashov <<a href="mailto:dionisiydk@gmail.com" target="_blank">dionisiydk@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><span></span></div></blockquote><blockquote type="cite"><div><div dir="ltr">Hi.<div><br></div><div>I am experimenting with interrupt callbacks on Rasperry. I am using WiringPi library which allows to set the function which should be called when value of particular pin is changed.</div><div><br></div><div>But instead of callback execution I got following message in the console:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Warning; callback failed to own the VM</span></p><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p></div></blockquote><font color="#000000" face="Menlo"><span style="font-size:11px">So VM is not crashed. But every interrupt produces such message.</span></font><div><font color="#000000" face="Menlo"><span style="font-size:11px"><br></span></font><div><font color="#000000" face="Menlo"><span style="font-size:11px">Is it related to the fact that callback is triggered from the thread different from VM? (I not sure about such detail, just guessing)</span></font></div></div></div></div></blockquote><div><br></div>Indeed it is.  You would need to either</div></blockquote><div><br></div><div>At least VM do not crash. This is nice. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>- arrange that interrupts are delivered on the VM thread, e.g. by responding to the interrupt on the foreign thread by queueing the information, and using the external semaphore support to inform the image of the interrupt</div><div>- help us finish the threaded FFI so that the callback can be received from the foreign thread</div><div>- find out how a SqueakNOS VM handles receiving an interrupt at any time, or specific times (IIRC the Digitalk VM required the image to execute an enableInterrupts and a disableInterrupts bytecode around code that was executed when the VM is used n a state to take interrupts.</div><div><br></div><div>The thing I do not understand about SqueakNOS and responding to an interrupt at an arbitrary time is how one expects to deal with handling an interrupt during some sequence of instructions that is between suspension points, such as mid way through a store check which is adding an object to the remembered set, or mid way through a message lookup.  Does SqueakNOS actually use the enable/disable interrupts approach?</div><div><br></div><div><br></div><div>Denis, can you describe the callbacks in more detail?  What is their favorite nation? Must they be responded to immediately? <br></div></div></blockquote><div><br></div><div>Signature is very simple:</div><div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>int wiringPiISR (int pin, int edgeType,  void (*function)(void)) ;</div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>I just checked how VM works in that case. It is not critical. Normally I just poll pin value.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><div><br><blockquote type="cite"><div><div dir="ltr"><div><div><br></div><div>Best regards</div><div>Denis</div></div></div>
</div></blockquote></div></div></div><br></blockquote></div><br></div></div>