Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mono: faster Tick on client by bypassing remoting AppDomain transitio…
…ns, fix thread suspension deadlock
- Loading branch information
1 parent
463c946
commit 5575937
Showing
8 changed files
with
193 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,59 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Security; | ||
|
||
namespace CitizenFX.Core | ||
{ | ||
internal class PushRuntime : IDisposable | ||
{ | ||
private readonly IScriptRuntime m_runtime; | ||
private readonly IntPtr m_runtime; | ||
private readonly IScriptRuntime m_actualRuntime; | ||
private static IScriptRuntimeHandler ms_runtimeHandler; | ||
private static IntPtr ms_runtimeHandlerIface; | ||
|
||
private static FastMethod<Action<IntPtr, IntPtr>> ms_pushMethod; | ||
private static FastMethod<Action<IntPtr, IntPtr>> ms_popMethod; | ||
|
||
[SecuritySafeCritical] | ||
public PushRuntime(IScriptRuntime runtime) | ||
{ | ||
EnsureRuntimeHandler(); | ||
|
||
#if !IS_FXSERVER | ||
var comRuntime = Marshal.GetComInterfaceForObject(runtime, typeof(IScriptRuntime)); | ||
ms_pushMethod.method(ms_runtimeHandlerIface, comRuntime); | ||
|
||
m_runtime = comRuntime; | ||
#else | ||
ms_runtimeHandler.PushRuntime(runtime); | ||
|
||
m_runtime = runtime; | ||
m_actualRuntime = runtime; | ||
#endif | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
ms_runtimeHandler.PopRuntime(m_runtime); | ||
#if IS_FXSERVER | ||
ms_runtimeHandler.PopRuntime(m_actualRuntime); | ||
#else | ||
ms_popMethod.method(ms_runtimeHandlerIface, m_runtime); | ||
#endif | ||
} | ||
|
||
[SecuritySafeCritical] | ||
private static void EnsureRuntimeHandler() | ||
{ | ||
if (ms_runtimeHandler == null) | ||
{ | ||
ms_runtimeHandler = InternalManager.CreateInstance<IScriptRuntimeHandler>(new Guid(0xc41e7194, 0x7556, 0x4c02, 0xba, 0x45, 0xa9, 0xc8, 0x4d, 0x18, 0xad, 0x43)); | ||
|
||
#if !IS_FXSERVER | ||
ms_pushMethod = new FastMethod<Action<IntPtr, IntPtr>>("PushRuntime", ms_runtimeHandler, typeof(IScriptRuntimeHandler), 0); | ||
ms_popMethod = new FastMethod<Action<IntPtr, IntPtr>>("PopRuntime", ms_runtimeHandler, typeof(IScriptRuntimeHandler), 2); | ||
|
||
ms_runtimeHandlerIface = Marshal.GetComInterfaceForObject(ms_runtimeHandler, typeof(IScriptRuntimeHandler)); | ||
#endif | ||
} | ||
} | ||
} | ||
} | ||
} |
Binary file modified
BIN
+558 Bytes
(100%)
code/components/citizen-scripting-mono/deps/lib/mono-2.0-sgen.lib
Binary file not shown.
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
Binary file not shown.
Binary file not shown.