hey, given I have variable of type function, is it...
# announcements
o
hey, given I have variable of type function, is it possible to know if the function currently is computing given this reference variable?
y
no. even this was possible, the function could stop computing in another thread between the point in time when you performed the check and the time where you make a decision based on the result of the check
u
Would love to know what use case you have for this. When would you actually want such a thing?
m
I guess you could wrap it in an object and override the
.invoke
operator calling the original invoke method for the function and setting
isComputing
to
true
.
o
@Anton I have a case where I have interconnected nodes on network. Each node can run a computationFunction which dynamically can be reloaded (through class loader), so in essence If the user of the node decides to change this computation function and set another one, I would like to be sure, that old function is not currently computing, otherwise there might be strange stuff happening on the responseChannel. Question is not critical, as I can work around as normal people do, as well as I THINK that even if I change the reference to the function, old still be able to finish it's computation and send the results through proper channels, as any references and context it had when started, still be present when it finishes
@muliyul yes I had thoughts along those lines thanks