I’m trying to use the invokeAsync/invokeLater pair to do come computation but the later part isn’t going to be doing anything to anything external so I’ve come across a problem - passing the data computed by invokeAsync or invokeLater to something outside the original system.util.invokeAsynchronous call.
See the below function:
def doAsyncLater(funcAsync, funcLater=None): import time timeStart = time.time() timeEnd = 0 def doAsync(): def doLater(timeEnd = timeEnd): funcChange("after") timeEnd = time.time() if funcLater is not None: funcLater() funcAsync() system.util.invokeLater(doLater) system.util.invokeAsynchronous(doAsync) return [timeEnd, timeStart]
In this example I’m trying to create a more generic invoke async/later pair for others to use that will calculate the time taken. Right now my issue is that timeEnd is always 0. I’ve done some reading about Python and how it deals with this and from that it seems like it somehow may not be possible to do what I want here, but I’m hoping someone here has an idea to get around this.