Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Program Call Instruction as a "Start Thread"

#1
Hello,

I want to make sure that I understand how the "start thread" option works when adding a Program Call Instruction.

   

I expect it to start a Python program running in a separate thread and that the thread will keep running forever - or until I have a nice way to stop it.  Do the threads get garbage collected when the program ends or do they keep going?

Brief summary, I want a thread that connects to a Ethernet device and maintains a socket connection to it.  Then the subsequent program calls can talk with that thread (probably using shared memory).  The last program call will tell the thread to disconnect and shut down.

I should add that the program will be run from RoboDK and not exported and sent to a robot controller.   Here is an example of how I think it might work...

   

Thanks for the insight,
Henry
#2
The thread will keep running regardless of the state of the program. 

You have a few options to stop your thread:
  1. Select the Escape key.
  2. Check if a program has stopped in your thread to stop the execution of your thread.
  3. Trigger another function that will stop the program.
#3
Albert -

That sounds great! This should work very well for my idea.

Henry
#4
Perfect, thank you for your feedback!
  




Users browsing this thread:
1 Guest(s)