From acd31f7145291f2e916ec37259adf6a41a61b93b Mon Sep 17 00:00:00 2001 From: Hyunseok Yang Date: Sun, 26 Jul 2020 14:48:37 +0900 Subject: [PATCH] Change function taking data from queue. -> TryTake() with timeout => Take() --- Assets/Scripts/Devices/Device.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/Devices/Device.cs b/Assets/Scripts/Devices/Device.cs index 8b5cafbb..008a5898 100644 --- a/Assets/Scripts/Devices/Device.cs +++ b/Assets/Scripts/Devices/Device.cs @@ -41,8 +41,6 @@ void OnDestroy() public float UpdatePeriod => 1f/updateRate; - public int UpdatePeriodInMillisecond => (int)(UpdatePeriod * SEC2MSEC); - public float TransportingTime => transportingTimeSeconds; public bool EnableDebugging @@ -211,18 +209,12 @@ protected bool PushData() public MemoryStream PopData() { - if (memoryStreamOutboundQueue == null) + if (memoryStreamOutboundQueue == null || memoryStreamOutboundQueue.Count == 0) { return null; } - if (memoryStreamOutboundQueue.TryTake(out var item, UpdatePeriodInMillisecond)) - { - return item; - } - else - { - return null; - } + var item = memoryStreamOutboundQueue.Take(); + return item; } } \ No newline at end of file