From 95385297482e8c1dfa3f5556905e3bfb8aee60bd Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Mon, 22 Sep 2025 22:46:56 -0400 Subject: [PATCH] move sendmsg to network thread --- ntalk.tcl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ntalk.tcl b/ntalk.tcl index 35bcbaefc10dc21187fa3c66e109e5c54e8debcd..946bffa4b5d8ede17bb121a58f370a7bd0465046 100755 --- a/ntalk.tcl +++ b/ntalk.tcl @@ -688,7 +688,7 @@ proc setlastmsg {new} { } set lastmsg 0 -set netcode { +set netcode { ### ENTER SECTION THAT MAY BE THREADED ### set lastmsg 0 proc sendl {line} { @@ -732,6 +732,13 @@ proc send {line} { return 0 } +proc sendmsg {msg} { + if {[send $msg]} { + bufpush "$msg" + bufdown + } +} + proc poll {} { global lastmsg sendl "POLL $lastmsg" @@ -784,7 +791,7 @@ proc doskip {delay} { } set pmid [after $delay doskip $delay] } -} +}; ### END OF SECTION THAT MAY BE THREADED ### if {[catch {package require Thread}] == 0} { # threading supported! set threads 1 @@ -814,6 +821,7 @@ if {[catch {package require Thread}] == 0} { # threading supported! interp alias {} hist {} thread::send -async $nett hist proc send {line} [subst -nocommands { thread::send $nett [list send [set line]] }] + proc sendmsg {line} [subst -nocommands { thread::send -async $nett [list sendmsg [set line]] }] proc pollmsgs {n} [subst -nocommands { thread::send -async $nett [list pollmsgs [set n]] }] proc last {n} [subst -nocommands { thread::send -async $nett [list last [set n]] }] } else { @@ -870,14 +878,6 @@ proc bufclear {} { if !$threads update } -proc sendmsg {msg} { - global lastmsg - if {[send $msg]} { - bufpush "$msg" - bufdown - } -} - proc n64k_secs {msgcount} { # 2025-09-19 01:59:38 GMT set proto_epoch 1758247178