Attached Status Change Before or After Calling onAttach Handler?
Posted: Fri Jan 31, 2020 10:29 am
Hi. I am curious, does the attached status returned by getAttached() change before or after the onAttach handler gets called?
I would like to call some function once all Phidgets in my system have been attached. This is easy if I use openWaitForAttachment(), but I am curious about how to do this without blocking code.
Is there a way I could do this with onAttach handlers? If I attach the same onAttach handler to every Phidget, then each time it gets called I can check to see if all of the other Phidgets have been attached. The check would fail for all onAttach handler calls except the very last one called by the last Phidget to get attached.
This will not work, though, if the attached status changes after the onAttach handler returns. The very last Phidget to get attached will not say it is attached in the getAttached() call within the onAttach handler.
Is there a better way to asynchronously trigger some function call once all Phidgets in some set have been attached? Thanks!
I would like to call some function once all Phidgets in my system have been attached. This is easy if I use openWaitForAttachment(), but I am curious about how to do this without blocking code.
Is there a way I could do this with onAttach handlers? If I attach the same onAttach handler to every Phidget, then each time it gets called I can check to see if all of the other Phidgets have been attached. The check would fail for all onAttach handler calls except the very last one called by the last Phidget to get attached.
This will not work, though, if the attached status changes after the onAttach handler returns. The very last Phidget to get attached will not say it is attached in the getAttached() call within the onAttach handler.
Is there a better way to asynchronously trigger some function call once all Phidgets in some set have been attached? Thanks!