Skip to content

Commit 4d8a41f

Browse files
Merge pull request #27 from gerasiov/master
console_linux: Fix race: lock Cond before Signal.
2 parents 9a57d21 + 5d1b48d commit 4d8a41f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

console_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,14 @@ func (ec *EpollConsole) Shutdown(close func(int) error) error {
262262

263263
// signalRead signals that the console is readable.
264264
func (ec *EpollConsole) signalRead() {
265+
ec.readc.L.Lock()
265266
ec.readc.Signal()
267+
ec.readc.L.Unlock()
266268
}
267269

268270
// signalWrite signals that the console is writable.
269271
func (ec *EpollConsole) signalWrite() {
272+
ec.writec.L.Lock()
270273
ec.writec.Signal()
274+
ec.writec.L.Unlock()
271275
}

0 commit comments

Comments
 (0)