DC-11: locking fix
This commit is contained in:
parent
e12507eb7c
commit
44317e69c0
1 changed files with 4 additions and 2 deletions
6
dc11.cpp
6
dc11.cpp
|
@ -119,6 +119,8 @@ void dc11::operator()()
|
||||||
pfds[client_i].fd = accept(pfds[i].fd, nullptr, nullptr);
|
pfds[client_i].fd = accept(pfds[i].fd, nullptr, nullptr);
|
||||||
set_nodelay(pfds[client_i].fd);
|
set_nodelay(pfds[client_i].fd);
|
||||||
|
|
||||||
|
std::unique_lock<std::mutex> lck(input_lock[i]);
|
||||||
|
|
||||||
registers[i * 4 + 0] |= 0160000; // "ERROR", RING INDICATOR, CARRIER TRANSITION
|
registers[i * 4 + 0] |= 0160000; // "ERROR", RING INDICATOR, CARRIER TRANSITION
|
||||||
if (is_rx_interrupt_enabled(i))
|
if (is_rx_interrupt_enabled(i))
|
||||||
trigger_interrupt(i);
|
trigger_interrupt(i);
|
||||||
|
@ -129,11 +131,11 @@ void dc11::operator()()
|
||||||
if (pfds[i].revents != POLLIN)
|
if (pfds[i].revents != POLLIN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int line_nr = i - dc11_n_lines;
|
|
||||||
|
|
||||||
char buffer[32] { };
|
char buffer[32] { };
|
||||||
int rc = read(pfds[i].fd, buffer, sizeof buffer);
|
int rc = read(pfds[i].fd, buffer, sizeof buffer);
|
||||||
|
|
||||||
|
int line_nr = i - dc11_n_lines;
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lck(input_lock[line_nr]);
|
std::unique_lock<std::mutex> lck(input_lock[line_nr]);
|
||||||
|
|
||||||
if (rc <= 0) { // closed or error?
|
if (rc <= 0) { // closed or error?
|
||||||
|
|
Loading…
Add table
Reference in a new issue