-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add script termination option to 'Lua Scripts' floater #1152
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
799d1d5
Add script termination option to 'Lua Scripts' floater
maxim-productengine e6aa6d2
mac build fix - remove unused variable
maxim-productengine 5ce6c02
Merge branch 'release/luau-scripting' into lua-terminate-script
nat-goodspeed 396ae60
'Lua Scripts' floater clean up
maxim-productengine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting to look at this made me realize that I want to write a mechanism to request termination of an arbitrary C++ coroutine, not just one running Lua.
Quick sketch: I want to add a new data structure indicating a terminate request to
LLCoros
, plus anLLEventStream
. TheLLCoros
constructor will cause its"LLCoros"
LLEventPump
to listen on"LLApp"
so that events posted to"LLApp"
will be passed along on"LLCoros"
.I'll make
LLCoros::checkStop()
check for a termination request for this specific coroutine, in addition to checking for general viewer shutdown.There are a few different places where a coroutine listens on
"LLApp"
for viewer shutdown events. I'll change those to listen on"LLCoros"
instead.The point of the distinction is that then I can resurrect the commented-out
LLCoros::kill()
method to set a termination request for the subject coroutine. But in case the subject coroutine is waiting for an event,kill()
will also post a heads-up event on"LLCoros"
to cause each waiting coroutine to check for a termination request. I'd rather not post that event on the more generic"LLApp"
event pump.So what I think I'd like to do is to accept this PR (once you're done; I realize you're still refining it) and then recast it to use the termination mechanism described above. I'll probably remove this second
post()
call at that time.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I missed the ability to terminate coroutine once or twice in the past when working on maint bugs. So, I'm for it.
I'm not planning any more changes for now for this PR. (there will be some changes related to script termination as you know, but I'll create separate pr)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry to say I overlooked an important point. I can indeed introduce a flag for the next time a given coroutine wakes up and calls
LLCoros::checkStop()
, but I can't cause that coroutine to wake up and check it. AnLLEventStream
listener runs on the coroutine callingpost()
. An exception thrown by such a listener will propagate through thepost()
call.The Boost.Fiber library we use does not provide a way to force an exception onto a suspended fiber -- although tantalizingly, the Boost.Context library on which it's based provides a mechanism that could support that. At present, the best we can do is to wait for the subject coroutine to call
checkStop()
.