daily update on 20240403 by nitload youmu
This commit is contained in:
@@ -48,9 +48,9 @@ namespace StgSharp.Graphics
|
||||
private ConcurrentQueue<IntPtr> _funcQueue;
|
||||
private readonly unsafe GLcontext* currentContext;
|
||||
|
||||
public unsafe FrameOperationBuffer(IglFunc gl)
|
||||
public unsafe FrameOperationBuffer()
|
||||
{
|
||||
currentContext = gl.Context;
|
||||
currentContext = GL.api;
|
||||
_funcQueue = new ConcurrentQueue<IntPtr>();
|
||||
}
|
||||
|
||||
@@ -497,9 +497,10 @@ namespace StgSharp.Graphics
|
||||
public class FrameAsyncThread
|
||||
{
|
||||
|
||||
private int _priority;
|
||||
|
||||
private Thread _task;
|
||||
private volatile int _terminateToken;
|
||||
private int _priority;
|
||||
|
||||
protected Barrier _frameSpeedSyncBarrier;
|
||||
|
||||
@@ -518,7 +519,7 @@ namespace StgSharp.Graphics
|
||||
public int Priority
|
||||
{
|
||||
get => _priority;
|
||||
internal set { _priority = value; }
|
||||
internal set => _priority = value;
|
||||
}
|
||||
|
||||
public ThreadStart TaskTODO
|
||||
@@ -545,7 +546,6 @@ namespace StgSharp.Graphics
|
||||
_taskTODO();
|
||||
_spanCompleteBarrier.SignalAndWait();
|
||||
}
|
||||
Console.WriteLine("Thread terminated");
|
||||
});
|
||||
_task.Start();
|
||||
}
|
||||
@@ -558,14 +558,6 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
public static void WaitAll(IEnumerable<FrameAsyncThread> threadList)
|
||||
{
|
||||
foreach (FrameAsyncThread t in threadList)
|
||||
{
|
||||
t._task.Join();
|
||||
}
|
||||
}
|
||||
|
||||
public static (Barrier, Barrier) CombineAsync(bool needOuterMonitor, IEnumerable<FrameAsyncThread> taskList)
|
||||
{
|
||||
if (taskList.Count() == 0)
|
||||
@@ -597,10 +589,24 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
return (b_start, b_complete);
|
||||
}
|
||||
public static Barrier CombineAsyncAfter(Barrier begin, bool needOuterMonitor, IEnumerable<FrameAsyncThread> taskList)
|
||||
{
|
||||
if (taskList.Count() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Barrier b_complete = new Barrier(taskList.Count() + (needOuterMonitor ? 1 : 0));
|
||||
foreach (FrameAsyncThread item in taskList)
|
||||
{
|
||||
item._frameSpeedSyncBarrier = begin;
|
||||
item._spanCompleteBarrier = b_complete;
|
||||
}
|
||||
return b_complete;
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
{
|
||||
Interlocked.Exchange(ref _terminateToken,0);
|
||||
Interlocked.Exchange(ref _terminateToken, 0);
|
||||
}
|
||||
|
||||
public static void TerminateAll(params FrameAsyncThread[] threadList)
|
||||
@@ -619,6 +625,14 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
public static void WaitAll(IEnumerable<FrameAsyncThread> threadList)
|
||||
{
|
||||
foreach (FrameAsyncThread t in threadList)
|
||||
{
|
||||
t._task.Join();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user