6 namespace org { namespace ldk { namespace structs {
10 * A simple future which can complete once, and calls some callback(s) when it does so.
12 public class Future : CommonBase {
13 internal Future(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.Future_free(ptr); }
19 * Registers a callback to be called upon completion of this future. If the future has already
20 * completed, the callback will be called immediately.
22 public void register_callback_fn(org.ldk.structs.FutureCallback callback) {
23 bindings.Future_register_callback_fn(this.ptr, callback.ptr);
25 GC.KeepAlive(callback);
26 if (this != null) { this.ptrs_to.AddLast(callback); };
30 * Waits until this [`Future`] completes.
33 bindings.Future_wait(this.ptr);
38 * Waits until this [`Future`] completes or the given amount of time has elapsed.
40 * Returns true if the [`Future`] completed, false if the time elapsed.
42 public bool wait_timeout(long max_wait) {
43 bool ret = bindings.Future_wait_timeout(this.ptr, max_wait);
45 GC.KeepAlive(max_wait);