X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ricxappframe%2Fxapp_frame.py;h=f278cf15a1aae79c5e32d159a9540cbe7ca03242;hb=5b582d6c144615002b5108f1d5cf94f1b70e6029;hp=6b70bb6a944e38f5f9e16c657597ee8b2ea7c75e;hpb=f9cd5cc676355485c2d9c8bc2be22ddad4874382;p=ric-plt%2Fxapp-frame-py.git diff --git a/ricxappframe/xapp_frame.py b/ricxappframe/xapp_frame.py index 6b70bb6..f278cf1 100644 --- a/ricxappframe/xapp_frame.py +++ b/ricxappframe/xapp_frame.py @@ -303,11 +303,16 @@ class RMRXapp(_BaseXapp): """ self._dispatch[message_type] = handler - def run(self): + def run(self, thread=False): """ This function should be called when the client xapp is ready to wait for their handlers to be called on received messages - execution is returned to caller + Parameters + ---------- + thread: bool (optional) + if thread is True, execution is returned to caller and the queue read loop is executed in a thread. + The thread can be stopped using .stop() + if False, execution is not returned and the framework loops """ def loop(): @@ -320,7 +325,10 @@ class RMRXapp(_BaseXapp): func = self._default_handler func(self, summary, sbuf) - Thread(target=loop).start() + if thread: + Thread(target=loop).start() + else: + loop() def stop(self): """