chiark / gitweb /
Add a thread lock to the machineCom _sendCommand
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Tue, 8 Dec 2015 19:52:49 +0000 (14:52 -0500)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Tue, 8 Dec 2015 19:52:49 +0000 (14:52 -0500)
commita348b3a92a7ea3fd6d09fb630d5a721a5fba52bf
tree8b5b9642ec633ad7081d2bad35686b6e9d1bcff6
parent6bfa9ac4f50cde9d9ae7c217bef2a3161140735f
Add a thread lock to the machineCom _sendCommand

This is the real cause for the serial WriteTimeout on Windows.
It looks like the win32 pyserial has a concurrency issue and is not
thread-safe, so when we receive commands from the UI (such as 'print',
'pause', 'resume', 'temp' or custom gcode), they get executed from the
main thread and if we receive an 'ok' from the firmware on the serial
monitor thread, it can cause the next command to be sent from the monitor
thread causing data to be written to serial from two threads, which causes
pyserial to just cancel both writes with a WriteTimeoutException.
Fixes T332
Cura/util/machineCom.py