Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
windows: lock tty output before updating the virtual window size
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Aug 21, 2012
1 parent 564e7c7 commit 03bdfd0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/win/tty.c
Expand Up @@ -527,11 +527,16 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle,
/* way that matters to libuv. */
if (handle->last_input_record.EventType == WINDOW_BUFFER_SIZE_EVENT) {
CONSOLE_SCREEN_BUFFER_INFO info;
if (uv_tty_output_handle == INVALID_HANDLE_VALUE)
continue;
if (!GetConsoleScreenBufferInfo(uv_tty_output_handle, &info))
continue;
uv_tty_update_virtual_window(&info);

EnterCriticalSection(&uv_tty_output_lock);

if (uv_tty_output_handle != INVALID_HANDLE_VALUE &&
GetConsoleScreenBufferInfo(uv_tty_output_handle, &info)) {
uv_tty_update_virtual_window(&info);
}

LeaveCriticalSection(&uv_tty_output_lock);

continue;
}

Expand Down

0 comments on commit 03bdfd0

Please sign in to comment.