popForcefully

suspend fun popForcefully(): Boolean

Pops this scope from the current thread's scope stack.

For well-behaved usages, this scope is at the top of the stack. It is popped from the stack and the method returns true.

If this scope is not at the top of the stack then this method attempts to close each of the intermediate scopes by invoking their .tryClose method. If tryClose succeeds then the scope is removed from the stack. When done, this scope is removed from the stack and false is returned.

This method does nothing, and returns false, if this scope is not on the current thread's scope stack.

Return

true if this scope was at the top of the stack, otherwise false

Throws

WrongThreadException

it the current thread is not the owner