mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
ConsoleWindow racecon fix and highlight
RollingList is not thread safe, but the lock around it was inconsistent, resulting in occasional null value in the log list. Fixed by utilizing ConcurrentQueue so that logs can be added from any thread without locks, and reading from the queue and adding to the list from the framework thread. Also, added log line highlight feature.
This commit is contained in:
parent
88a8d45798
commit
14a5e5b652
2 changed files with 537 additions and 264 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Dalamud.Utility;
|
||||
|
||||
|
|
@ -19,6 +20,7 @@ public static class ThreadSafety
|
|||
/// Throws an exception when the current thread is not the main thread.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Thrown when the current thread is not the main thread.</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void AssertMainThread()
|
||||
{
|
||||
if (!threadStaticIsMainThread)
|
||||
|
|
@ -31,6 +33,7 @@ public static class ThreadSafety
|
|||
/// Throws an exception when the current thread is the main thread.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Thrown when the current thread is the main thread.</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void AssertNotMainThread()
|
||||
{
|
||||
if (threadStaticIsMainThread)
|
||||
|
|
@ -39,6 +42,15 @@ public static class ThreadSafety
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary><see cref="AssertMainThread"/>, but only on debug compilation mode.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void DebugAssertMainThread()
|
||||
{
|
||||
#if DEBUG
|
||||
AssertMainThread();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks a thread as the main thread.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue