mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 06:13:27 -07:00
Change while
to if
on txcmd_pending
(per @pwpiwi comment); add note on race condition ugliness.
This commit is contained in:
parent
582cceff01
commit
006bedd3f1
1 changed files with 3 additions and 2 deletions
|
@ -92,13 +92,14 @@ void SendCommand(UsbCommand *c) {
|
||||||
// unresponsive or disconnected. The main console thread is alive, but comm
|
// unresponsive or disconnected. The main console thread is alive, but comm
|
||||||
// thread just spins here. Not good.../holiman
|
// thread just spins here. Not good.../holiman
|
||||||
pthread_mutex_lock(&txcmd_lock);
|
pthread_mutex_lock(&txcmd_lock);
|
||||||
while (txcmd_pending) {
|
if (txcmd_pending) {
|
||||||
// Receiver thread will signal when it is ready for us to continue.
|
// Receiver thread will signal when it is ready for us to continue.
|
||||||
pthread_cond_wait(&txcmd_sig, &txcmd_lock);
|
pthread_cond_wait(&txcmd_sig, &txcmd_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send command buffer to receiver thread for processing. This is slower, but
|
// Send command buffer to receiver thread for processing. This is slower, but
|
||||||
// there are many race conditions which would otherwise be triggered.
|
// there may be race conditions which would otherwise be triggered.
|
||||||
|
// Introduced in https://github.com/Proxmark/proxmark3/commit/f0ba634
|
||||||
txcmd = *c;
|
txcmd = *c;
|
||||||
txcmd_pending = true;
|
txcmd_pending = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue