Skip to content

Commit

Permalink
AllowedThread
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmoresena committed Jul 16, 2024
1 parent ae7d31d commit 530df5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ private static InvokeInterfaceProxy GetProxy(JVirtualMachineRef vmRef)
{
InvokeInterfaceProxy? result = ReferenceHelper.invokeProxies.GetValueOrDefault(vmRef);
if (result is not null && result.Reference.Reference.Pointer != ptr) result = default;
if (result?.AllowedThread != null && result.AllowedThread != Environment.CurrentManagedThreadId)
result = default;
return result ?? InvokeInterfaceProxy.Detached;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public abstract class InvokeInterfaceProxy
public JMethodId StackTraceElementIsNativeMethodMethodId { get; } = ReferenceHelper.Fixture.Create<JMethodId>();

public JVirtualMachineRef Reference { get; private set; }
public Int32? AllowedThread { get; set; } = Environment.CurrentManagedThreadId;

public abstract JResult DestroyVirtualMachine();
public abstract JResult AttachCurrentThread(ValPtr<JEnvironmentRef> envRef,
Expand Down

0 comments on commit 530df5c

Please sign in to comment.