1616import uuid
1717import warnings
1818from datetime import datetime
19+ from functools import partial
1920from signal import SIGINT , SIGTERM , Signals
2021
2122from .thread import CONTROL_THREAD_NAME
@@ -536,7 +537,7 @@ async def start(self, *, task_status: TaskStatus = TASK_STATUS_IGNORED) -> None:
536537 self .control_stop = threading .Event ()
537538 if not self ._is_test and self .control_socket is not None :
538539 if self .control_thread :
539- self .control_thread .add_task (self .control_main )
540+ self .control_thread .start_soon (self .control_main )
540541 self .control_thread .start ()
541542 else :
542543 tg .start_soon (self .control_main )
@@ -551,11 +552,11 @@ async def start(self, *, task_status: TaskStatus = TASK_STATUS_IGNORED) -> None:
551552
552553 # Assign tasks to and start shell channel thread.
553554 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 )
557558 )
558- self .shell_channel_thread .add_task (manager .listen_from_subshells )
559+ self .shell_channel_thread .start_soon (manager .listen_from_subshells )
559560 self .shell_channel_thread .start ()
560561 else :
561562 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:
10851086 # This should only be called in the control thread if it exists.
10861087 # Request is passed to shell channel thread to process.
10871088 other_socket = await self .shell_channel_thread .manager .get_control_other_socket (
1088- self .control_thread . get_task_group ()
1089+ self .control_thread
10891090 )
10901091 await other_socket .asend_json ({"type" : "create" })
10911092 reply = await other_socket .arecv_json ()
@@ -1109,7 +1110,7 @@ async def delete_subshell_request(self, socket, ident, parent) -> None:
11091110 # This should only be called in the control thread if it exists.
11101111 # Request is passed to shell channel thread to process.
11111112 other_socket = await self .shell_channel_thread .manager .get_control_other_socket (
1112- self .control_thread . get_task_group ()
1113+ self .control_thread
11131114 )
11141115 await other_socket .asend_json ({"type" : "delete" , "subshell_id" : subshell_id })
11151116 reply = await other_socket .arecv_json ()
@@ -1126,7 +1127,7 @@ async def list_subshell_request(self, socket, ident, parent) -> None:
11261127 # This should only be called in the control thread if it exists.
11271128 # Request is passed to shell channel thread to process.
11281129 other_socket = await self .shell_channel_thread .manager .get_control_other_socket (
1129- self .control_thread . get_task_group ()
1130+ self .control_thread
11301131 )
11311132 await other_socket .asend_json ({"type" : "list" })
11321133 reply = await other_socket .arecv_json ()
0 commit comments