"send on signal"

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Posts: 44
Joined: Fri May 16, 2008 1:26 am

"send on signal"

Post by pderocco » Tue Sep 18, 2018 7:11 am

One limitation of the desktop externals interface is the inability for an asynchronous OS callback to invoke a message in LiveCode. The iOS externals interface seems to have a "post message" type of function that the external can call, and it would be nice if the desktop externals interface did too, but it blocks until the engine is at a point where it can accept the message, which might be a problem.

Where I run up against this is in receiving MIDI: I have to poll my external with a timer, using something like

Code: Select all

send TimerTick to stack "Main" in 5 milliseconds
But this demonstrates that the LiveCode desktop engine can indeed respond to an asynchronous event: a timer. I'm wondering if it wouldn't be fairly easy to add something like:

Code: Select all

send ReadInput to stack "Main" on signal 1
where 1 is just an arbitrary integer that allows multiple distinct signals to be handled. The external interface would simply need a function that sends a signal with an int parameter.

The two could be combined, for implementing a timed wait:

Code: Select all

send ReadResponse to stack "Main" on signal 1 or in 5 milliseconds
where the handler, in this case ReadResponse, would get a boolean parameter that indicates whether the input was received or the time limit was reached.

This sort of feature would eliminate a lot of timed polling, and result in faster response times to input events.

Post Reply

Return to “Feature Proposals”