16
16
import uuid
17
17
import warnings
18
18
from datetime import datetime
19
+ from functools import partial
19
20
from signal import SIGINT , SIGTERM , Signals
20
21
21
22
from .thread import CONTROL_THREAD_NAME
@@ -536,7 +537,7 @@ async def start(self, *, task_status: TaskStatus = TASK_STATUS_IGNORED) -> None:
536
537
self .control_stop = threading .Event ()
537
538
if not self ._is_test and self .control_socket is not None :
538
539
if self .control_thread :
539
- self .control_thread .add_task (self .control_main )
540
+ self .control_thread .start_soon (self .control_main )
540
541
self .control_thread .start ()
541
542
else :
542
543
tg .start_soon (self .control_main )
@@ -551,11 +552,11 @@ async def start(self, *, task_status: TaskStatus = TASK_STATUS_IGNORED) -> None:
551
552
552
553
# Assign tasks to and start shell channel thread.
553
554
manager = self .shell_channel_thread .manager
554
- self .shell_channel_thread .add_task (self .shell_channel_thread_main )
555
- self .shell_channel_thread .add_task (
556
- manager .listen_from_control , self .shell_main , self .shell_channel_thread
555
+ self .shell_channel_thread .start_soon (self .shell_channel_thread_main )
556
+ self .shell_channel_thread .start_soon (
557
+ partial ( manager .listen_from_control , self .shell_main , self .shell_channel_thread )
557
558
)
558
- self .shell_channel_thread .add_task (manager .listen_from_subshells )
559
+ self .shell_channel_thread .start_soon (manager .listen_from_subshells )
559
560
self .shell_channel_thread .start ()
560
561
else :
561
562
if not self ._is_test and self .shell_socket is not None :
@@ -1085,7 +1086,7 @@ async def create_subshell_request(self, socket, ident, parent) -> None:
1085
1086
# This should only be called in the control thread if it exists.
1086
1087
# Request is passed to shell channel thread to process.
1087
1088
other_socket = await self .shell_channel_thread .manager .get_control_other_socket (
1088
- self .control_thread . get_task_group ()
1089
+ self .control_thread
1089
1090
)
1090
1091
await other_socket .asend_json ({"type" : "create" })
1091
1092
reply = await other_socket .arecv_json ()
@@ -1109,7 +1110,7 @@ async def delete_subshell_request(self, socket, ident, parent) -> None:
1109
1110
# This should only be called in the control thread if it exists.
1110
1111
# Request is passed to shell channel thread to process.
1111
1112
other_socket = await self .shell_channel_thread .manager .get_control_other_socket (
1112
- self .control_thread . get_task_group ()
1113
+ self .control_thread
1113
1114
)
1114
1115
await other_socket .asend_json ({"type" : "delete" , "subshell_id" : subshell_id })
1115
1116
reply = await other_socket .arecv_json ()
@@ -1126,7 +1127,7 @@ async def list_subshell_request(self, socket, ident, parent) -> None:
1126
1127
# This should only be called in the control thread if it exists.
1127
1128
# Request is passed to shell channel thread to process.
1128
1129
other_socket = await self .shell_channel_thread .manager .get_control_other_socket (
1129
- self .control_thread . get_task_group ()
1130
+ self .control_thread
1130
1131
)
1131
1132
await other_socket .asend_json ({"type" : "list" })
1132
1133
reply = await other_socket .arecv_json ()
0 commit comments