protected void Write(byte[] data) { Packet[] packets = dataSplitter.Split(data); foreach (var item in packets) { Write(item); } /* * maxParallelTransfersSemaphore.Wait(); * for (int i = 0; i < packets.Length; i++) * { * Interlocked.Increment(ref writeSemaphoreWaiters); * writeSemaphore.Wait(); * Interlocked.Decrement(ref writeSemaphoreWaiters); * Write(packets[i]); * if (i + 1 != packets.Length) * { * Interlocked.Increment(ref writeNextSemaphoreWaiters); * } * if (writeSemaphoreWaiters == 0 && writeNextSemaphoreWaiters > 0) * { * writeNextSemaphore.Release(); * } * else * { * writeSemaphore.Release(); * } * if (i + 1 != packets.Length) * { * writeNextSemaphore.Wait(); * Interlocked.Decrement(ref writeNextSemaphoreWaiters); * } * else * { * break; * } * if (writeNextSemaphoreWaiters == 0) * { * writeSemaphore.Release(); * } * else * { * writeNextSemaphore.Release(); * } * }*/ maxParallelTransfersSemaphore.Release(); }
private void SplitSamplesIntoDataSets(float[] samples, out float[] xSamples, out float[] ySamples) => splitter.Split(samples, numberOfSamples, out xSamples, out ySamples);