File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import java.util.concurrent.Semaphore
77import java .util .concurrent .atomic .AtomicBoolean
88import scala .concurrent .ExecutionException
99import scala .util .control .NonFatal
10+ import scala .util .control .NoStackTrace
1011
1112/** Starts a fork (logical thread of execution), which is guaranteed to complete before the enclosing [[supervised ]] or [[supervisedError ]]
1213 * block completes.
@@ -199,7 +200,9 @@ def forkCancellable[T](f: => T)(using OxUnsupervised): CancellableFork[T] =
199200 // will cause the scope to end, interrupting the task if it hasn't yet finished (or potentially never starting it)
200201 done.release()
201202 if ! started.getAndSet(true )
202- then result.completeExceptionally(new InterruptedException (" fork was cancelled before it started" )).discard
203+ then result.completeExceptionally(new InterruptedException (" fork was cancelled before it started" ) with NoStackTrace ).discard
204+ // #161: not generating the stack trace in case the task was cancelled before it started, as this isn't going to
205+ // contain any useful information anyway (no user code was executed), and it provides better performance
203206 end new
204207end forkCancellable
205208
You can’t perform that action at this time.
0 commit comments