Skip to content
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

Bugfix 0008 dispatch on managed thread #10

Merged
merged 11 commits into from
Jan 11, 2020

Conversation

cozzyy2002
Copy link
Owner

@cozzyy2002 cozzyy2002 commented Jan 11, 2020

See #8

Basic idea is that native StateMachine runs on managed thread that belongs AppDomain of application.
Then native code can interact with managed code in the same AppDomain.
In this way, native::Callback class removed at 5cb47ea is no more used.
And workaround for nunit3-console.exe described on #8 (comment) is also no more necessary.

Constructor of AsyncContext of StateMachine.NET accepts bool useNativeThread parameter.
If it is false(default), native StateMachine creates native thread as it's worker thread.
In this case, nunit throws System.AugumentException.
To avoid this issue, pass true as bool useNativeThread to dispatch native StateMachine code on native thread.

… native thread.

 * Running test in Test Explorer passed.
 * Debugging test in Test Explorer thorws invalid handle exception at calling  `CloseHandle(exitThreadEvent)` in  StateMachine.NET::ManagedDispatcher::!ManagedDispatcher().
 * nunit3-console.exe failed by exception.
 * Test by nunit3-console.exe passed.
 * Debuggin test in Test Explorer still fails.
  - Move exitThreadEvent handle from managed class to native class to avoid exception when ManagedDispatcher is disposed.
  - Debugging test in Test Explorer passed.
Because native thread can run on AppDomain of native code.
…tateMachine.

Change Context constructor of tsm_NET to accept ThreadType parameter.
  - Remove Context::ThreadType enum.
  - Add AsyncContext class which inherits from Context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant