Phidget_close handling of callbacks

C, C++, and Visual C++
chefdeletat
Fresh meat
Posts: 1
Joined: Sat May 09, 2026 1:32 am

Phidget_close handling of callbacks

Post by chefdeletat »

In the Phidget22 c library, does Phidget_close block until in-flight invocations of the channel's onAttach / onDetach / onError handlers return?
User avatar
burley
Human-Cyborg Relations
Posts: 30
Joined: Tue Sep 27, 2011 2:37 pm
Location: Calgary

Re: Phidget_close handling of callbacks

Post by burley »

Yes. Close will attempt to delete any incoming events once it has begun executing. It closes the device immediately and then waits until any communication ends before completing and anything it gets in the meantime it will ignore/throw away.
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com
User avatar
Patrick
Lead Developer
Posts: 702
Joined: Mon Jun 20, 2005 8:46 am
Location: Calgary

Re: Phidget_close handling of callbacks

Post by Patrick »

Phidget_close won't block waiting for an event that was invoked before you called close - it simply cancels any pending events that were waiting to be dispatched. If an event is inflight, it may complete after close returns - this also allows you to call close from within an event callback. If you call close, you won't get a detach event.

-Patrick