Work on refactoring send kitten to fix various issues

This commit is contained in:
Kovid Goyal
2023-08-08 06:28:43 +05:30
parent 0971e8c630
commit 0e87e0c7de
8 changed files with 69 additions and 72 deletions

View File

@@ -285,6 +285,7 @@ func (self *Loop) run() (err error) {
// queueing and startup of writer thread and also as a performance
// optimization to avoid copying unnecessarily to pending_writes
self.tty_write_channel = make(chan write_msg, 512)
self.write_msg_id_counter = 0
write_done_channel := make(chan IdType)
self.wakeup_channel = make(chan byte, 256)
self.pending_writes = make([]write_msg, 0, 256)
@@ -452,7 +453,7 @@ func (self *Loop) run() (err error) {
case msg_id := <-write_done_channel:
self.flush_pending_writes(self.tty_write_channel)
if self.OnWriteComplete != nil {
err = self.OnWriteComplete(msg_id)
err = self.OnWriteComplete(msg_id, msg_id < self.write_msg_id_counter)
if err != nil {
return err
}