Introduce a generic shared buffer with typed span access and timeout-based read/write waits. Update the sample to verify data shared between two buffer views.
14 lines
341 B
C#
14 lines
341 B
C#
|
|
using SharedMemory;
|
|
|
|
try
|
|
{
|
|
using var numbers = new SharedArray<int>("MySharedArray");
|
|
Console.WriteLine(numbers.Length);
|
|
Console.WriteLine(numbers[0]);
|
|
Console.WriteLine(numbers[^1]);
|
|
}
|
|
catch (FileNotFoundException)
|
|
{
|
|
Console.WriteLine("No process has MySharedArray open. Start the first program before this one.");
|
|
} |