User functions

Recommended Posts

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? 

Link to comment
Share on other sites

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.)

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.