Skip to content
Snippets Groups Projects
Commit 6d0e136b authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Concurrent.Future: Added query_{success,failure}_callbacks().

parent 2286e78f
No related branches found
No related tags found
No related merge requests found
...@@ -207,7 +207,7 @@ class Future ...@@ -207,7 +207,7 @@ class Future
//! @[cb] will always be called from the main backend. //! @[cb] will always be called from the main backend.
//! //!
//! @seealso //! @seealso
//! @[on_failure()] //! @[on_failure()], @[query_success_callbacks()]
this_program on_success(function(mixed, mixed ... : void) cb, mixed ... extra) this_program on_success(function(mixed, mixed ... : void) cb, mixed ... extra)
{ {
switch (state) { switch (state) {
...@@ -223,6 +223,18 @@ class Future ...@@ -223,6 +223,18 @@ class Future
return this_program::this; return this_program::this;
} }
//! Query the set of active success callbacks.
//!
//! @returns
//! Returns an array with callback functions.
//!
//! @seealso
//! @[on_success()], @[query_failure_callbacks()]
array(function) query_success_callbacks()
{
return column(success_cbs, 0);
}
//! Register a callback that is to be called on failure. //! Register a callback that is to be called on failure.
//! //!
//! @param cb //! @param cb
...@@ -237,7 +249,7 @@ class Future ...@@ -237,7 +249,7 @@ class Future
//! @[cb] will always be called from the main backend. //! @[cb] will always be called from the main backend.
//! //!
//! @seealso //! @seealso
//! @[on_success()] //! @[on_success()], @[query_failure_callbacks()]
this_program on_failure(function(mixed, mixed ... : void) cb, mixed ... extra) this_program on_failure(function(mixed, mixed ... : void) cb, mixed ... extra)
{ {
switch (state) { switch (state) {
...@@ -256,6 +268,18 @@ class Future ...@@ -256,6 +268,18 @@ class Future
return this_program::this; return this_program::this;
} }
//! Query the set of active failure callbacks.
//!
//! @returns
//! Returns an array with callback functions.
//!
//! @seealso
//! @[on_failure()], @[query_success_callbacks()]
array(function) query_failure_callbacks()
{
return column(failure_cbs, 0);
}
//! Apply @[fun] with @[val] followed by the contents of @[ctx], //! Apply @[fun] with @[val] followed by the contents of @[ctx],
//! and update @[p] with the result. //! and update @[p] with the result.
protected void apply(mixed val, Promise p, protected void apply(mixed val, Promise p,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment