Skip to content

Commit 8ba2caf

Browse files
crysbotysbaddaden
andauthored
Fix run win32 console reader in bare thread (#15724) (#15726)
Co-authored-by: Julien Portalier <[email protected]>
1 parent 5454f2e commit 8ba2caf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/crystal/system/win32/file_descriptor.cr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,11 @@ private module ConsoleUtils
519519
@@read_requests = Deque(ReadRequest).new
520520
@@bytes_read = Deque(Int32).new
521521
@@mtx = ::Thread::Mutex.new
522-
{% if flag?(:execution_context) %}
523-
@@reader_thread = ::Fiber::ExecutionContext::Isolated.new("READER-LOOP") { reader_loop }
524-
{% else %}
525-
@@reader_thread = ::Thread.new { reader_loop }
526-
{% end %}
522+
523+
# Start a dedicated thread to block on reads from the console. Doesn't need an
524+
# isolated execution context because there's no fiber communication (only
525+
# thread communication) and only blocking I/O within the thread.
526+
@@reader_thread = ::Thread.new { reader_loop }
527527

528528
private def self.reader_loop
529529
while true

0 commit comments

Comments
 (0)