Commit 88b2abde authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

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.
parent eab2ec6a
......@@ -884,9 +884,6 @@ class Promise
final int _materialised;
final AggregateState _astate;
#if CONCURRENT_DEBUG
array(Pike.BacktraceFrame) createdat;
#endif
//! Creates a new promise, optionally initialised from a traditional callback
//! driven method via @expr{executor(success, failure, @@extra)@}.
......@@ -897,9 +894,6 @@ class Promise
function(function(mixed:void),
function(mixed:void), mixed ...:void) executor, mixed ... extra)
{
#if CONCURRENT_DEBUG
createdat = backtrace()[..<1];
#endif
state = STATE_NO_FUTURE;
if (executor)
executor(success, failure, @extra);
......@@ -1201,14 +1195,20 @@ class Promise
return max_failures(-1);
}
private string orig_backtrace =
#ifdef CONCURRENT_DEBUG
sprintf("%s\n------\n", describe_backtrace(backtrace()))
#else
""
#endif
;
protected void _destruct()
{
// NB: Don't complain about dropping STATE_NO_FUTURE on the floor.
if (state == STATE_PENDING)
try_failure(({ sprintf("%O: Promise broken.\n", this),
#if CONCURRENT_DEBUG
this->createdat ||
#endif
try_failure(({ sprintf("%O: Promise broken.\n%s",
this, orig_backtrace),
backtrace() }));
if ((state == STATE_REJECTED) && global_on_failure)
call_callback(global_on_failure, result);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment