MCPcopy Index your code
hub / github.com/tiny-pilot/tinypilot / background_thread

Function background_thread

app/execute.py:96–109  ·  view source on GitHub ↗

Runs the given function in a background thread. Note: The function is executed in a "fire and forget" manner. Args: function: The function to be executed in a thread. args: Optional `function` arguments as a tuple.

(function, args=None)

Source from the content-addressed store, hash-verified

94
95
96def background_thread(function, args=None):
97 """Runs the given function in a background thread.
98
99 Note: The function is executed in a "fire and forget" manner.
100
101 Args:
102 function: The function to be executed in a thread.
103 args: Optional `function` arguments as a tuple.
104 """
105 # Never wait or join a regular thread because it will block the SocketIO
106 # server:
107 # https://github.com/miguelgrinberg/Flask-SocketIO/issues/1264#issuecomment-620653614
108 thread = threading.Thread(target=function, args=args or ())
109 thread.start()

Callers

nothing calls this directly

Calls 1

startMethod · 0.80

Tested by

no test coverage detected