public unsafe Task Start(ArgMap args) { return(Task.Run(() => { Passed = true; var p = stackalloc NoRefsStruct[1]; var str = p[0]; str.Int = int1; str.Dbl = dbl1; var mps = MarshalSlot.Store(str); Task.Run(() => useParkingSlot(mps)); var p2 = MarshalSlot.Reserve <NoRefsStruct>(out MarshalSlot mps2); p2->Int = int2; p2->Dbl = dbl2; Task.Run(() => useParkingSlot(mps2)); var mpsLarge = new MarshalSlot(20000000); mpsLarge.Span().Fill(7); })); }
public async Task Start(IDictionary <string, List <string> > args) { var ta = new TestArgs(args); var s = ta.AE; var t = ta.BE; var a = new XPU(new XCfg( new BeamerCfg() { Log = new BeamerLogCfg("a", ta.Log) }, new XLogCfg("a-Replies", ta.Log), new HeapHighway(ushort.MaxValue))); var b = new XPU(new XCfg( new BeamerCfg() { Log = new BeamerLogCfg("b", ta.Log) }, new XLogCfg("b-Replies", ta.Log), new HeapHighway(ushort.MaxValue))); MarshalSlot ms = null; try { b.RegisterAPI("ep", entry_point); a.Start(s, t); b.Start(t, s); await a.TargetIsActive(); await b.TargetIsActive(); ms = MarshalSlot.Store(8); var x = await a.RawRequest("ep", ms, false, TIMEOUT); int data = 0; x.Fragment.Read(ref data, x.DataOffset); while (data > 0 && !x.DoNotReply) { data--; ms.Write(data, 0); x = await x.RawReply(ms, data < 1, true, TIMEOUT); if (!x.IsOK) { Passed = false; FailureMessage = "Timeout"; return; } if (x.State == XState.Beamed) { x.Fragment.Read(ref data, x.DataOffset); } } await Task.Delay(TIMEOUT.Milliseconds * 3); if (!Passed.HasValue) { Passed = true; IsComplete = true; } } catch (Exception ex) { Passed = false; FailureMessage = ex.ToString(); } finally { a.Dispose(); b.Dispose(); ms.Dispose(); } }