Concurrent.Promise: {success,failure}_cbs need to always contain arrays. query_{success,failure}_callbacks() do not like when they contain zeroes. Fixes [WS-670]. Already fixed in Pike master (a3dfc367775d52d9907e8d7f5f6a142cd36c57c1).
Work in progress: Sakura master
Concurrent: Adjust lots of function prototypes.
Concurrent: Stricter handling of zero.
Concurrent.Promise: Disable debug output.
Concurrent: Fix types for callback functions.
Concurrent.AggregatedPromise: Fix type for aggregate_cb(). aggregate_cb() is called from start() with UNDEFINED as the third argument.
Concurrent: Fix syntax to be compatible with Pike 8.0.886 and earlier. Modules in Pike 8.0 need to be syntax-compatible with all released versions of Pike 8.0 (or at least Pike 8.0.232 and later).
Concurrent: Handle possible backend change in timeout() Concurrent.Future()->timeout() could fail to remove the call_out if the backend of the corresponding Promise is changed after calling timeout().
Concurrent: Fix Future()->timeout() call_callback() may use call_out(cb, 0, ...) to call a callback. This means that if we call multiple callbacks wie call_callback(), they mæy be executed in arbitrary order. The implementation of Future()->timeout() was subject to races in this regard, leading to the Future returned by ->timeout() to resolve with 0 instead of the result or instead of rejecting with the same reason as the original Promise/Future was rejected before the timeout triggered. Using less abstractions, we save on such races, Future objects, and even lambdas while getting arguably eaiser to read code.
Improved documentation.
Concurrent: Explicit error on executor rejection failure This is not perfect (as we currently have no way of properly chaining errors), but this should provide more helpful error messages to developers who somehow manage to throw in the executor after finalising the promise some other way.
Concurrent: Catch executor throwing and convert to rejection There is arguably little reason to use the executor 'API' if not for it doing this.
Concurrent.Promise: Fix recursive mutex lock errors. Do not call callbacks while holding the mutex lock. Fixes multiple testsuite failures.
Concurrent.Promise: Fixed race-condition in finalise(). The API for finalise() raced with on_{success,failure}(), as new callbacks could get registered after finalise() was called, but before the state was updated. Fixes #10055.
Concurrent: minor autodoc fix
Concurrent: Silence console messages unless debugging
Concurrent: Move handling of aggregated promises to AggregatePromise. This simplifies the code for promises that do not use aggregation, and avoids bugs when aggregation functions are used in combination with non-aggregation functions.
Concurrent.AggregateState: Added CAVEAT LECTOR.
Concurrent.Promise: Improved behavior for CONCURRENT_DEBUG. Don't store raw backtraces, they may contain references to stuff that the user doesn't expect to get extra references.
Concurrent.Future: Added try_get().
Concurrent.Future: Added query_{success,failure}_callbacks().
Concurrent.AggregateState: Protect create().
Concurrent.Promise: Refactored the dependency handling. Get rid of multiple cases of circular referencing via AggregateState. Removes the AggregateState class. The folding function no longer gets called with failure values. The successful array result no longer contains failed values. References between Promises and Futures should now strictly be only in the result notification direction. API-compatible, user level code should not notice any differences.
Concurrent: Add CONCURRENT_DEBUG to get more meaningful broken-promises.
Merge remote-tracking branch 'origin/master' into new_utf8
Concurrent: Fixed syntax error in recent backport.
Concurrent.Promise: Introduce delay() and optimise timeout().
Concurrent.Promis: Fix/optimise delay() and timeout().
Concurrent.Promise: Add delay() member to delay the future.
Concurrent: Default global_on_failure() to master()->handle_error(). This reduces risk of lost error messages from Concurrent.Promise el al.
Concurrent.Pomise: Improved diagnostics for broken promises. The Promise has typically already been destructed when the backtrace is described, so ensure that it at least is present in the message. Fixes PIKE-181 (#8181).
Concurrent.Future: Events may still occur after the timeout. Fixes spurious complaint "Promise has already been finalised." when a promise with a timeout is fullfilled after the timeout has triggered. Fixes PIKE-177 (#8177).
Concurrent: Moved some initialization code to __INIT(). This fixes an issue with the variable callout not being initialized properly in classes that have inherited Concurrent. Fixes some of the issues in [WS-404].
Concurrent.Future: Added wait(). This differs from get() in that it will not throw on failure.
Concurrent.Promise: Fix handling of rejections. The global rejection callback (installed via Concurrent.on_failure()) must not be called before the user has had a chance to register custom rejection callbacks (via Concurrent.Future()->on_failure()). Calling of the global rejection callback is now deferred until the Promise is destructed. Fixes erroneous reporting of unhandled Promise errors.
Concurrent.Promise: Reduce number of complaints. Don't complain about dropping promises that have no corresponding future on the floor. As the promises have no future, nobody is affected by them not being fulfilled.
Documentation [Concurrent]: Note where backend state isn't propagated.
Concurrent.Future: Added promise_factory(). This makes propagating state to new Promises easier. New Promises are now created with the same backend as the Promise they originated from.
Documentation [Concurrent]: Added note about backend disabled mode.
Concurrent.Future: Reduce references. There's no point in having the timeout call_out after the Promise has been fulfilled, so remove it (if any).
Concurrent.Future: Added {get,set}_backend(). This makes it possible to have a custom Pike.Backend handle the callbacks for the Future.
Concurrent.Future: Added internal function call_callback(). This makes it possible to adjust the way that callbacks are called via overloading. The typical use case is for wanting callbacks to be called by some other thread than the backend.
Merge remote-tracking branch 'origin/8.1' into gobject-introspection
Hide AggregateState
Concurrent.results: Handle an empty argument array properly. Previously code such as: Concurrent.Future f2 = Concurrent.results(({})); f2->on_success(lambda(array(string) a) { werror("success: %O.\n", a); }) ->on_failure(lambda(mixed err) { werror (describe_backtrace(err)); }); ... would lead to a backtrace because the future was destructed prematurely.
Concurrent: Various improvements, bugfixes, backported from 8.1. Add map_with() as an alias for flat_map(). Reduce lock contention and cleanup superfluous catches. Clarify docs. Free callbacks after use, frees memory and references. Add convenience variant to zip() and extend testsuite. Transparent automatic backend enable/disable.
Merge remote-tracking branch 'origin/8.1' into peter/travis
Concurrent: Transparent automatic backend enable/disable.
Concurrent: Reduce stackdepth, minimise catch() breadth.
Concurrent: Slight optimisation and typo fix.
Promise: Update docs again.
Concurrent: Improve more docs.
Concurrent: Improve docs.
Concurrent: Add convenience variant to zip() and extend testsuite.
Concurrent: Free callbacks after use, frees memory and references.
Concurrent: So much for tail call optimisation; exception isolation ruined it.
Concurrent: Facilitate tail call optimisation.
Concurrent: Clarify docs.
Concurrent: Reduce lock contention and cleanup superfluous catches. The interpreter lock will protect trivial cases. The natural destruction at the end of a block takes care of some unlocks.
Concurrent: Add use_backend() to allow promises without a running backend.
Revert obfuscating ?: uses.
Normalize style.
Simplified fold_one() slightly. Interpretor lock ensures promise is either set or not.
Concurrent.Promise: Reduce mutex contention, memory usage, simplify code, fix a few races.
Concurrent: Cleanup.
Concurrent.Promise: Harmonise method names (failed -> failures).
Concurrent.Promise: Improve docs.
Concurrent.Promise: Small cleanups(2).
Concurrent.Promise: Small cleanups.
Concurrent.Promise: depend() fixes. Rename apply_fold() to fold(). Add first_completed(). Add min_failed(), max_failed(), any_results().
Concurrent: Add map_with() as an alias for flat_map().
Concurrent.Future: depend(),fold() and apply_fold(); interfacechange.
Promise: Rename fold_finish() to apply_fold().
Promise: Fix docs.
Promise: Add depend(), fold() and fold_finish() methods.
Merge branch 'grubba/rename_lfun_destroy' into 8.1 * grubba/rename_lfun_destroy: Modules: Fixed logts of warnings. Testsuite: Updated for LFUN::_destruct(). Compiler: Don't complain about LFUN::destroy() in compat mode. Fix multiple warnings. Runtime: LFUN::destroy() has been renamed to _destruct(). Compiler: Rename LFUN::destroy() to LFUN::_destruct().
Modules: Fixed logts of warnings. More fall out from the LFUN::destroy ==> LFUN::_destruct rename.
Added Concurrent, and moved changes not in the next release to next beta.
Added _sprintf
Somewhat stricter type on global on_failure.
Added a global on_failure to capture errors not handled in individual promises.
Concurrent: Support creating promises from traditional methods with callbacks.
Concurrent: then() and thencatch() support smart mapping, improve docs.
Concurrent: JavaScript API fixes, convenience APIs added.
Concurrent: Doc fixes and simplify code.
Concurrent: Implement then() and other JavaScript APIs.
Added #pike
Concurrent: Improved thread safety for Results and Fold.
Concurrent.Promise: Changed API somewhat. success() and failure() now throw errors if the Future isn't in the STATE_PENDING state. Add try_success() that is a noop if the Future isn't pending. Renamed maybe_failure() to try_failure() for symmetry with try_success(). Clean up FirstCompleted by using try_success() and try_failure().
Concurrent.Future: Support multiple concurrent callbacks. Multiple success and failure callbacks may now be registered concurrently. This is needed to avoid surprises when implicit callbacks are installed by eg flat_map(). Also some related documentation updates. Fixes [bug 7816 (#7816)].
Concurrent.Promise: Fixed bug in maybe_failure(). maybe_failure() should now work as documented.
Concurrent.Promise: Fixed potential backtrace in destroy(). destroy() now uses unlocked_failure() to avoid potential recursive mutex locks. Also converted some comments to AutoDoc.
Concurrent.Future: Added timeout().
Concurrent.Promise: Added maybe_failure().
Concurrent.Promise: Added unlocked variants of success() and failure().
Documentation [Concurrent]: Fixed a few typos.
Protocols.HTTP.Query: Fixed an old bug (https://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=7676) where basically the timeout in timed_async_fetch wasn't reset each new data read. This timeout had it's own property (data_timeout) which now is "deprecated" since the property "timeout" pretty much serves the same purpose, but on connection. So now timeout is the default value to use unless data_timeout is explicitly set, in which case that value will be used. Since there was no proper way to set a max time for the entire operation (well, that was by accident and not intention how the data_timeout in timed_async_fetch worked) the new property "maxtime" has been added. If this is set (default is 0=indefinetly) the request will be aborted after maxtime second even if data is still being read. So in short: data_timeout = 0 // unless explicitly set timeout = 120 // connection timeout, and then data read timeout maxtime = 0 // 0 = off, otherwise the entire operation must be done within maxtime seconds or else the request is aborted Protocols.HTTP.Session: Added some documentation Protocols.HTTP.Promise: New module which utilise the new Concurrent.Promise/Future stuff for HTTP requests. Internally uses Protcols.HTTP.Session for the actual HTTP stuff. Web.Api.Api: Now fetches data asynchronously when async calls are made. Concurrent: on_success and on_fail now returns the object being called so that they can be chained. Parser.Markdown: Fixed the #require macro directive.
Concurrent.pmod: The Result class was always stuck in a PENDING state since new copies of the result and state arrays was created in the loop in the contructor. Moved the initiation of these arrays outside of the loop.
Concurrent: Fixed some typos.
Concurrent: Added some more functions.
Concurrent.Future: Added some common methods. Also adds some more documentation.
Concurrent: Added new module for handling asynchronous results.