Le 25/05/2013 20:54, CJ a écrit : > >> What happens if there is no code at all inside the interrupt handler? > > The same thing. > >> Do you know in which context the interrupt handler is run? (signal >> handler context? Something else?) > > Here is the response from wiringPi's author Gordon Henderson... > > The interrupt handler is a standard pthread process. The wiringPiISR code > creates the thread and that thread then waits for the interrupt, then > calls the ISR function - so the function called has to be "thread safe" - > something I possibly ought to better document...
The interpreter cannot be run in another thread. This is the reason why you get a crash. Two possible solutions : 1) A pure Gambas solution. But that needs writing a component in C/C++ to implement an interrupt handler that would write to a pipe that would be read by the main thread (the one that runs the Gambas interpreter). 2) Ask to the wiringPi's author to add a new function to handle the interrupt (or modify the current one) that proceeds that way: - Create an internal pipe. - Create the thread. - When an interrupt occurs, the thread writes a byte to the pipe. - The function returns the file descriptor of the other side of the pipe. That way, Gambas would just have to watch the file descriptor returned by the new wiringPiISR function to know if an interrupt has occured. Note that many other interpreters will be happy with that solution! Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user