Skip to content

Commit 1019a1d

Browse files
authored
Use thread instead of process, in example. (#931)
1 parent c3028bf commit 1019a1d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/common/callback_server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
a device-mapping file.
88
"""
99
import logging
10-
from multiprocessing import Queue, Process
10+
from multiprocessing import Queue
11+
from threading import Thread
1112

1213
# --------------------------------------------------------------------------- #
1314
# import the modbus libraries we need
@@ -138,8 +139,8 @@ def run_callback_server():
138139
# ----------------------------------------------------------------------- #
139140
# run the server you want
140141
# ----------------------------------------------------------------------- #
141-
proc = Process(target=device_writer, args=(queue,))
142-
proc.start()
142+
thread = Thread(target=device_writer, args=(queue,))
143+
thread.start()
143144
StartTcpServer(context, identity=identity, address=("localhost", 5020))
144145

145146

0 commit comments

Comments
 (0)