Even though Processing enqueues input events in a separate Thread, it dequeues them in the main “Animation” Thread.
So it’s safe to “draw” when using Processing’s own input callbacks.
Now, if a 3rd-party library deals w/ hardware, its callbacks got a very high chance to happen in a separate Thread.
Therefore, it’s highly unsafe to mutate the main canvas under a separate Thread.
In order to find out which Thread is executing a method, just place this statement there: println(Thread.currentThread());