MCPcopy Index your code
hub / github.com/benfry/processing4 / run

Method run

java/libraries/io/src/processing/io/GPIO.java:137–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

135 // of latency
136 Thread t = new Thread(new Runnable() {
137 public void run() {
138 boolean gotInterrupt = false;
139 try {
140 do {
141 try {
142 if (waitForInterrupt(irqPin, 100)) {
143 gotInterrupt = true;
144 }
145 if (gotInterrupt && serveInterrupts) {
146 irqMethod.invoke(irqObject, irqPin);
147 gotInterrupt = false;
148 }
149 // if we received an interrupt while interrupts were disabled
150 // we still deliver it the next time interrupts get enabled
151 // not sure if everyone agrees with this logic though
152 } catch (RuntimeException e) {
153 // make sure we're not busy spinning on error
154 Thread.sleep(100);
155 }
156 } while (!Thread.currentThread().isInterrupted());
157 } catch (Exception e) {
158 // terminate the thread on any unexpected exception that might occur
159 System.err.println("Terminating interrupt handling for pin " + irqPin + " after catching: " + e.getMessage());
160 }
161 }
162 }, "GPIO" + pin + " IRQ");
163
164 t.setPriority(Thread.MAX_PRIORITY);

Callers

nothing calls this directly

Calls 3

waitForInterruptMethod · 0.95
getMessageMethod · 0.65
printlnMethod · 0.45

Tested by

no test coverage detected