1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
public unsafe void LockNLoad(ref int j, byte[][] cBufs, byte[][] xBufs, byte[][] oLaps)
{
fixed (byte* tL0 = oLaps[j], tc0 = cBufs[j], tb0 = xBufs[j]) // Pin the buffers in memory
{
OVERLAPPED* ovLapStatus = (OVERLAPPED*)tL0;
ovLapStatus->hEvent = (uint)PInvoke.CreateEvent(0, 0, 0, 0);
// Pre-load the queue with a request
int len = BufSz;
EndPoint.BeginDataXfer(ref cBufs[j], ref xBufs[j], ref len, ref oLaps[j]);
j++;
if (j < QueueSz)
LockNLoad(ref j, cBufs, xBufs, oLaps); // Recursive call to pin next buffers in memory
else
XferData(cBufs, xBufs, oLaps); // All loaded. Let's go!
}
} |
Partager