This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Implement runtime suspension for OSX #1610
Merged
janvorli
merged 1 commit into
dotnet:master
from
janvorli:osx-thread-suspension-activation-2
Sep 23, 2015
Merged
Implement runtime suspension for OSX #1610
janvorli
merged 1 commit into
dotnet:master
from
janvorli:osx-thread-suspension-activation-2
Sep 23, 2015
Conversation
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
@@ -314,6 +314,10 @@ namespace CorUnix | |||
DWORD m_dwLwpId; | |||
pthread_t m_pthreadSelf; | |||
|
|||
#if HAVE_MACH_THREADS | |||
mach_port_t m_machPortSelf; |
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 don't see this being cleaned up when the thread dies, which means we'll leak the port.
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.
Are you sure it needs a cleanup? I was under an impression that the pthread_mach_thread_np just exposes mach port that is stored in the pthread_t and is bound to it.
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.
You're correct, I just checked and it isn't cloned or ref'd so this should be ok.
cc: @sergiy-k |
LGTM |
This change implements runtime suspension for OSX using activation injection, the same mechanism as Linux uses. I have modified the activation injection mechanism by adding a new function that CoreCLR registers with PAL and PAL calls it to check if an instruction address is safe for injection. The injection is performed only if this new function returns true. The activation on OSX is performed by suspending the target thread, checking the instruction address in the suspended thread's context using the above mentioned function and modifying the context to perform the injection only at injection safe place.
janvorli
force-pushed
the
osx-thread-suspension-activation-2
branch
from
September 23, 2015 19:25
867ca0c
to
0f6c0c3
Compare
LGTM |
janvorli
added a commit
that referenced
this pull request
Sep 23, 2015
…on-2 Implement runtime suspension for OSX
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…nsion-activation-2 Implement runtime suspension for OSX Commit migrated from dotnet/coreclr@a2491e3
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This change implements runtime suspension for OSX using activation
injection, the same mechanism as Linux uses.
I have modified the activation injection mechanism by adding a new
function that CoreCLR registers with PAL and PAL calls it to check
if an instruction address is safe for injection. The injection is
performed only if this new function returns true.
The activation on OSX is performed by suspending the target thread,
checking the instruction address in the suspended thread's context
using the above mentioned function and modifying the context to
perform the injection only at injection safe place.
As an additional detail, I have fixed the #1594, since it was similar to the activation handler wrapper creation.