×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Threading of driver calls

  • Posts: 86
  • Thank you received: 5
Hi there, I have a newbie developer question, apologies if it is answered in the developer manual, I couldn't find the answer there.

While my driver is performing function X (e.g. MoveFocuser()), is it possible for any of the other public functions to be called, or any of the driver variables to be changed? Just trying to understand if I can use things like FocusAbsPosN and FocusSpeedN in there and whether I have to protect against collisions (e.g. of MoveFocuser() with MoveFocuserAbs() or MoveFocuserRel()).

Rob
8 years 3 weeks ago #7549

Please Log in or Create an account to join the conversation.

So if you're asking if you can build a multi-threaded INDI driver then the answer is YES.

Now to your specific example, you'd have to protect against any calls that cause conflict in the driver. So if you make a call to MoveFocuserAbs() and it started moving, then a call to MoveFocuserRel() could be rejected because motion is in progress. As mentioned in the manual, the ultimate authority rests with the driver. Noticed I said "could" above. In principle, you can abort the absolute motion and execute the relative motion if so desired.
The following user(s) said Thank You: Rob Meades
8 years 3 weeks ago #7553

Please Log in or Create an account to join the conversation.

  • Posts: 86
  • Thank you received: 5
Thanks for the very swift response :) . It's less that I want to develop a multi-threaded driver, more that I'm trying to be a good boy and write one that works if it ever happens to be driven from more than one entity. So provided Indiserver only runs a single thread of my driver code, I can put in place protection against sequences of calls to the public driver functions that might collide with motion of the focus motor.

Rob
8 years 3 weeks ago #7554

Please Log in or Create an account to join the conversation.

Time to create page: 0.736 seconds