The way to decompile a function in Ghidra Python is:
decomp = DecompInterface()
decomp.openProgram(currentProgram)
decompile = decomp.decompileFunction(func, 1000, monitor)
However, in some cases, probably due to an error or corner case situations, the decompilation takes much more than expected.
Any ideas on how is it possible to cancel a decompilation task, using any kind of timeout, in Ghidra Python? I know that it's possible in the GUI.