Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrency issue with latest modification #7

Open
lafrank opened this issue Jun 25, 2017 · 2 comments
Open

Concurrency issue with latest modification #7

lafrank opened this issue Jun 25, 2017 · 2 comments

Comments

@lafrank
Copy link
Contributor

lafrank commented Jun 25, 2017

Although I think it is a very useful and great work, I also believe - but could be wrong - that there is a serious concurrency issue with latest modification "Update Arduino library for less CPU consumption".

This change has introduced a thread that initiates a timed event that is called in every 30ms to read the serial port, a much better approach than the original code. The problem is however, that the timer will tick and initiate a new call disregarding whether the execution of the previous call has finished or not. This results is multiple, simultaneously running instances of InputProcessor.InputProcess() method.

In my view, InputProcessor.InputProcess() should be enclosed in a Monitor.TryEnter(_serialPort) and Monitor.Exit(_serialPort) try-finally clause to prevent parallel execution.

See pull request #8 for details

@lafrank lafrank mentioned this issue Jun 25, 2017
dsjzn added a commit that referenced this issue Jun 27, 2017
Resolve issue #7, really thanks lafrank.
@LattePanda
Copy link
Member

LattePanda commented Jun 27, 2017 via email

@lafrank
Copy link
Contributor Author

lafrank commented Jun 27, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants