server: thread implementation fix, python should create a glib main loop.

This commit is contained in:
Koushik Dutta
2022-02-07 19:05:13 -08:00
parent 83810d2315
commit 49d044c771
3 changed files with 15 additions and 3 deletions

View File

@@ -23,6 +23,13 @@ from os import sys
import platform
import shutil
import gc
import threading
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib
Gst.init(None)
class SystemDeviceState(TypedDict):
lastEventTime: int
@@ -313,7 +320,7 @@ async def async_main(loop: AbstractEventLoop):
def main():
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
def gc_runner():
gc.collect()
@@ -325,4 +332,8 @@ def main():
if __name__ == "__main__":
main()
worker = threading.Thread(target=main)
worker.start()
loop = GLib.MainLoop()
loop.run()