Jump to content
The simFlight Network Forums

Recommended Posts

I know that if when a Lua script is running you re-invoke (recall) the same script, the previous script is 'killed' and replaced by the 'new' one.  My question is, if the script contains an ipc.sleep() function and that ipc.sleep function is active when the script is re-invoked (i.e., the script is sleeping), is the original script, and the ipc.sleep action, still instantly killed?  From some simple tests I tried it does seem 'everything' is killed when the script is re-invoked, but just wanted to check here in case someone has experienced something different in this regard.

Thanks,

Al

Link to post
Share on other sites
25 minutes ago, ark1320 said:

From some simple tests I tried it does seem 'everything' is killed when the script is re-invoked

Yes, it should be killed regardless of whether it is 'sleeping' or not. However, I suspect that if the process is sleeping due to a blocking system call, then it won't be killed before that is returned. This is why there are sometimes issues killing luas that use the com library.

Link to post
Share on other sites
1 hour ago, John Dowson said:

Yes, it should be killed regardless of whether it is 'sleeping' or not. However, I suspect that if the process is sleeping due to a blocking system call, then it won't be killed before that is returned. This is why there are sometimes issues killing luas that use the com library.

Well that's interesting. What I'm doing is calling a script that sets a flag after a delay -- the delay (set by the user) could be from about 0.5 to 3 seconds or so, and the script could be recalled before the delay has run its course. So I could implement the delay with ipc.sleep(), or use a delay loop that looks for a change in time using ipc.elapsedtime(). With respect to the blocking system call issue you mentioned, does the delay loop approach have any advantage over using ipc.sleep()?

Thanks,

Al

Link to post
Share on other sites
9 minutes ago, ark1320 said:

Well that's interesting. What I'm doing is calling a script that sets a flag after a delay -- the delay (set by the user) could be from about 0.5 to 3 seconds or so, and the script could be recalled before the delay has run its course. So I could implement the delay with ipc.sleep(), or use a delay loop that looks for a change in time using ipc.elapsedtime(). With respect to the blocking system call issue you mentioned, does the delay loop approach have any advantage over using ipc.sleep()?

No. Sleep is not a blocking system call, so the script will be killed anyway, as you observed.

Link to post
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.

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

Loading...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.