Skip to content

popCurrentSpan

@DelicateSpanApi
expect fun popCurrentSpan(current: Span)

@DelicateSpanApi
actual fun popCurrentSpan(current: Span)

Pops the currentSpan, checking that it is current.

This method forces the caller to provide what it thinks is the task that should be popped to check task ordering bugs early (for example if a subroutine has pushed a task but not popped it). In those cases, this function will throw an IllegalStateException with a detailed error report on the current task stack.

This is a low-level method to work with tasks. Unless you are writing some kind of library based on this project, you should use task instead.

Popping the Task.Root is forbidden and throws an IllegalArgumentException.