-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge fix(scripting-mono-v2): allow scheduling from non-main threads …
…(pr-2423) - c7b9c21 fix(scripting-mono-v2): allow scheduling from non-main threads
- Loading branch information
Showing
7 changed files
with
108 additions
and
59 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Runtime.InteropServices; | ||
using System.Threading; | ||
|
||
namespace CitizenFX.Core | ||
{ | ||
[StructLayout(LayoutKind.Explicit)] | ||
internal struct ScriptSharedData | ||
{ | ||
/// <summary> | ||
/// Next time when our host needs to call in again | ||
/// </summary> | ||
[FieldOffset(0)] public ulong m_scheduledTime; | ||
|
||
/// <summary> | ||
/// Same as <see cref="m_scheduledTime"/> but used in methods like <see cref="Interlocked.CompareExchange(ref long, long, long)" /> who miss a <see cref="ulong"/> overload. | ||
/// </summary> | ||
[FieldOffset(0)] public long m_scheduledTimeAsLong; | ||
}; | ||
} |
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
12 changes: 12 additions & 0 deletions
12
code/components/citizen-scripting-mono-v2/include/ScriptSharedData.h
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <atomic> | ||
|
||
namespace fx::mono | ||
{ | ||
struct ScriptSharedData | ||
{ | ||
public: | ||
std::atomic<uint64_t> m_scheduledTime = ~uint64_t(0); | ||
}; | ||
} |
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