Skip to content

Commit

Permalink
Adds refrence to issue #4 in GitHub issues tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
BjAlvestad committed Jun 6, 2019
1 parent 69370a7 commit dd355b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private float[] GetDistancesFromSimulator()
{
ValueSet valuesToSend = new ValueSet {{"LIDAR", ""}};

ValueSet dataReceived = Task.Run(() => _simulatorCommunication.RequestDataAsync(valuesToSend)).GetAwaiter().GetResult(); //TODO: This is a temporary hack that blocks the async method. WARNING MAY CAUSE ISSUES!. See if Read() can be rewritten to be async. See Figure 7 "The Thread Pool Hack" on https://msdn.microsoft.com/en-us/magazine/mt238404.aspx
ValueSet dataReceived = Task.Run(() => _simulatorCommunication.RequestDataAsync(valuesToSend)).GetAwaiter().GetResult(); //TODO: (ref. issue #4) This is a temporary hack that blocks the async method. WARNING MAY CAUSE ISSUES!. See if Read() can be rewritten to be async. See Figure 7 "The Thread Pool Hack" on https://msdn.microsoft.com/en-us/magazine/mt238404.aspx

return dataReceived["DATA"] as float[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void Write(MessageCode message, params int[] data)
valuesToSend.Add("NUM_OF_INTS", data.Length);
valuesToSend.Add("DATA", data);

_simulatorCommunication.SendMessageAsync(valuesToSend); //BUG: Since this async task is not awaited, it will swallow any exception. E.g. a failed write for setting wheel speed will never throw exception in Wheel classes TryCatch block.
_simulatorCommunication.SendMessageAsync(valuesToSend); //BUG: (ref. issue #4) Since this async task is not awaited, it will swallow any exception. E.g. a failed write for setting wheel speed will never throw exception in Wheel classes TryCatch block.
}

public VehicleDataPacket Read()
Expand All @@ -41,7 +41,7 @@ public VehicleDataPacket Read()
valuesToSend.Add("ADDRESS", (int)_simulatedDevice);
valuesToSend.Add("REQUEST", "");

ValueSet dataReceived = Task.Run(() => _simulatorCommunication.RequestDataAsync(valuesToSend)).GetAwaiter().GetResult(); //TODO: This is a temporary hack that blocks the async method. WARNING MAY CAUSE ISSUES!. See if Read() can be rewritten to be async. See Figure 7 "The Thread Pool Hack" on https://msdn.microsoft.com/en-us/magazine/mt238404.aspx
ValueSet dataReceived = Task.Run(() => _simulatorCommunication.RequestDataAsync(valuesToSend)).GetAwaiter().GetResult(); //TODO: (ref. issue #4) This is a temporary hack that blocks the async method. WARNING MAY CAUSE ISSUES!. See if Read() can be rewritten to be async. See Figure 7 "The Thread Pool Hack" on https://msdn.microsoft.com/en-us/magazine/mt238404.aspx

NewDataReceived?.Invoke(this, EventArgs.Empty);

Expand Down

0 comments on commit dd355b4

Please sign in to comment.