working on dynamic wrapping

This commit is contained in:
Youmu Liu
2025-11-06 18:12:04 +08:00
parent ea0e6f3ff6
commit ec1b8dbd51
9 changed files with 145 additions and 612 deletions
+6 -4
View File
@@ -92,7 +92,8 @@ namespace StgSharp
if (stack.TryPop(out int v))
{
popped.Add(v);
Console.WriteLine($"pop: {v}");
// Console.WriteLine($"pop: {v}");
} else
{
Thread.Yield();
@@ -111,7 +112,7 @@ namespace StgSharp
ready.Signal();
startGate.Wait();
int begin = captured * perProducer;
int begin = captured * perProducer + 10 * perProducer;
for (int j = 0; j < perProducer; j++)
{
stack.Push(begin + j);
@@ -146,12 +147,13 @@ namespace StgSharp
}
// Gather remaining data
List<int> remaining = new System.Collections.Generic.List<int>();
List<int> remaining = [];
while (stack.TryPop(out int value)) {
remaining.Add(value);
}
Console.WriteLine($"Popped count: {popped.Count}");
/**/
Console.WriteLine("Popped values:");
foreach (int v in popped)
{
@@ -159,7 +161,7 @@ namespace StgSharp
Console.Write('\t');
}
Console.WriteLine();
/**/
Console.WriteLine($"Remaining count: {remaining.Count}");
Console.WriteLine("Remaining values:");
foreach (int v in remaining)