cjbassman2 Posted February 6 Share Posted February 6 I've created a user function as a stand alone sequence that I'm successfully calling from my main sequence. Can this function be called simultaneously from two separate main sequences or do I need to create one for each calling sequence? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted February 7 Share Posted February 7 Functions are standalone and can be called by as many different sequences as you want. They are also reentrant so you can call them recursively as long as you are careful not to blow the stack (a general pitfall for recursive function calls). DAQFactory script in general is thread safe, though you do have to sometimes protect against multiple threads accessing common resources. The most common example is a comm / ethernet port. For this there is the lockPort() function. It is not that you will crash or hang DAQFactory, but if you don't protect the port, you could get framing overlap in your communcations (i.e. thread 1 makes a request, then thread 2 makes a request before thread 1 gets its reply. Thread 2 still has the processor and gets the request from thread1 instead of thread 2.) Quote Link to comment Share on other sites More sharing options...
cjbassman2 Posted February 7 Author Share Posted February 7 That's great thanks. I thought this was the case but wanted to check. Thanks also for the useful lockPort() function advice - could be useful 🙂 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.