Skip to content

Commit

Permalink
fixup to the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dkhalanskyjb committed Mar 4, 2024
1 parent 44ddd1a commit 6b5cc95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion kotlinx-coroutines-core/common/src/JobSupport.kt
Expand Up @@ -515,7 +515,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
*/
val latestState = this@JobSupport.state
if (latestState is Finishing) {
// Assumption: children always have `invokeImmediately = true`.
assert { invokeImmediately }
synchronized(latestState) { latestState.rootCause }?.let { handler.invoke(it) }
}
}
Expand Down
Expand Up @@ -84,8 +84,8 @@ public actual open class LockFreeLinkedListNode {
while (true) { // lock-free loop on prev.next
val currentPrev = prevNode
return when {
currentPrev is LIST_CLOSED_FOR_ALL -> false
currentPrev is LIST_CLOSED_FOR_SOME ->
currentPrev is ListClosedForAll -> false
currentPrev is ListClosedForSome ->
allowedAfterPartialClosing && currentPrev.addLast(node, allowedAfterPartialClosing)
currentPrev.addNext(node, this) -> true
else -> continue
Expand All @@ -96,12 +96,12 @@ public actual open class LockFreeLinkedListNode {
/**
* Forbids adding some of the new items to this list.
*/
public actual fun closeForSome() { addLast(LIST_CLOSED_FOR_SOME(), allowedAfterPartialClosing = false) }
public actual fun closeForSome() { addLast(ListClosedForSome(), allowedAfterPartialClosing = false) }

/**
* Forbids adding new items to this list.
*/
public actual fun close() { addLast(LIST_CLOSED_FOR_ALL(), allowedAfterPartialClosing = true) }
public actual fun close() { addLast(ListClosedForAll(), allowedAfterPartialClosing = true) }

/**
* Given:
Expand Down Expand Up @@ -291,6 +291,6 @@ public actual open class LockFreeLinkedListHead : LockFreeLinkedListNode() {
override val isRemoved: Boolean get() = false
}

private class LIST_CLOSED_FOR_SOME: LockFreeLinkedListNode()
private class ListClosedForSome: LockFreeLinkedListNode()

private class LIST_CLOSED_FOR_ALL: LockFreeLinkedListNode()
private class ListClosedForAll: LockFreeLinkedListNode()
Expand Up @@ -23,8 +23,8 @@ public open class LinkedListNode : DisposableHandle {
public inline val isRemoved get() = _removed

public fun addLast(node: Node, allowedAfterPartialClosing: Boolean): Boolean = when (val prev = this._prev) {
is LIST_CLOSED_FOR_ALL -> false
is LIST_CLOSED_FOR_SOME -> allowedAfterPartialClosing && prev.addLast(node, allowedAfterPartialClosing)
is ListClosedForAll -> false
is ListClosedForSome -> allowedAfterPartialClosing && prev.addLast(node, allowedAfterPartialClosing)
else -> {
node._next = this
node._prev = prev
Expand All @@ -35,11 +35,11 @@ public open class LinkedListNode : DisposableHandle {
}

public fun closeForSome() {
addLast(LIST_CLOSED_FOR_SOME(), allowedAfterPartialClosing = true)
addLast(ListClosedForSome(), allowedAfterPartialClosing = true)
}

public fun close() {
addLast(LIST_CLOSED_FOR_ALL(), allowedAfterPartialClosing = false)
addLast(ListClosedForAll(), allowedAfterPartialClosing = false)
}

/*
Expand Down Expand Up @@ -88,6 +88,6 @@ public open class LinkedListHead : LinkedListNode() {
public final override fun remove(): Nothing = throw UnsupportedOperationException()
}

private class LIST_CLOSED_FOR_SOME: LinkedListNode()
private class ListClosedForSome: LinkedListNode()

private class LIST_CLOSED_FOR_ALL: LinkedListNode()
private class ListClosedForAll: LinkedListNode()

0 comments on commit 6b5cc95

Please sign in to comment.