Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
b22c04c6
Commit
b22c04c6
authored
May 16, 2020
by
Stephen R. van den Berg
Browse files
Options
Downloads
Patches
Plain Diff
Concurrent: Add CONCURRENT_DEBUG to get more meaningful broken-promises.
parent
2d93703d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Concurrent.pmod
+15
-1
15 additions, 1 deletion
lib/modules/Concurrent.pmod
with
15 additions
and
1 deletion
lib/modules/Concurrent.pmod
+
15
−
1
View file @
b22c04c6
#pike __REAL_VERSION__
#pike __REAL_VERSION__
// Enable CONCURRENT_DEBUG to get more meaningful broken-promise messages
#define CONCURRENT_DEBUG 0
//! Module for handling multiple concurrent events.
//! Module for handling multiple concurrent events.
//!
//!
//! The @[Future] and @[Promise] API was inspired by
//! The @[Future] and @[Promise] API was inspired by
...
@@ -834,6 +838,9 @@ class Promise
...
@@ -834,6 +838,9 @@ class Promise
final int _materialised;
final int _materialised;
final AggregateState _astate;
final AggregateState _astate;
#if CONCURRENT_DEBUG
array(Pike.BacktraceFrame) createdat;
#endif
//! Creates a new promise, optionally initialised from a traditional callback
//! Creates a new promise, optionally initialised from a traditional callback
//! driven method via @expr{executor(success, failure, @@extra)@}.
//! driven method via @expr{executor(success, failure, @@extra)@}.
...
@@ -844,6 +851,9 @@ class Promise
...
@@ -844,6 +851,9 @@ class Promise
function(function(mixed:void),
function(function(mixed:void),
function(mixed:void), mixed ...:void) executor, mixed ... extra)
function(mixed:void), mixed ...:void) executor, mixed ... extra)
{
{
#if CONCURRENT_DEBUG
createdat = backtrace()[..<1];
#endif
state = STATE_NO_FUTURE;
state = STATE_NO_FUTURE;
if (executor)
if (executor)
executor(success, failure, @extra);
executor(success, failure, @extra);
...
@@ -1149,7 +1159,11 @@ class Promise
...
@@ -1149,7 +1159,11 @@ class Promise
{
{
// NB: Don't complain about dropping STATE_NO_FUTURE on the floor.
// NB: Don't complain about dropping STATE_NO_FUTURE on the floor.
if (state == STATE_PENDING)
if (state == STATE_PENDING)
try_failure(({ sprintf("%O: Promise broken.\n", this), backtrace() }));
try_failure(({ sprintf("%O: Promise broken.\n", this),
#if CONCURRENT_DEBUG
this->createdat ||
#endif
backtrace() }));
if ((state == STATE_REJECTED) && global_on_failure)
if ((state == STATE_REJECTED) && global_on_failure)
call_callback(global_on_failure, result);
call_callback(global_on_failure, result);
result = UNDEFINED;
result = UNDEFINED;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment