feat(pty): add multithread support

Adds the option `use_threads` to PTY (enabled by default) which improves
performance when enabled. For example, running `time cat file.txt` where
file is ~4.5MB will take ~0.250s with threads enabled, versus >20s when
disabled.
This commit is contained in:
Leroy Hopson 2024-03-02 13:20:33 +13:00
parent 46f3aa12bf
commit a0c9777264
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
3 changed files with 118 additions and 42 deletions

View file

@ -1,4 +1,4 @@
class_name UnixTest extends GutTest
class_name NixTest extends GutTest
var pty: PTY
var helper: Helper
@ -112,6 +112,15 @@ func test_emits_exited_with_signal():
assert_signal_emitted_with_parameters(pty, "exited", [0, PTY.SIGNAL_SIGSEGV])
# Run the same tests, but with use_threads = false.
class TestNoThreads:
extends NixTest
func before_each():
super.before_each()
pty.use_threads = false
class Helper:
static func get_pts() -> Array:
assert(false) #,"Abstract method")