Skip to content

Rewrite the implementation of the linked list for JobSupport #4095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make BrokenForSomeElements a non-value class
  • Loading branch information
dkhalanskyjb committed May 23, 2024
commit a025addcef9d823176cd3ffc488d7d735fa2b230
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal open class LockFreeLinkedListHead: LockFreeLinkedListSegment(
private val forbiddenBits: AtomicInt = atomic(0)

/**
* Iterates over all non-removed elements in this list, skipping every node until (and including) [startAfter].
* Iterates over all non-removed elements in this list, skipping every node until (and including) [startAfterIndex].
*/
inline fun forEach(
forbidBitmask: Byte = 0,
Expand Down Expand Up @@ -172,8 +172,7 @@ private fun createSegment(id: Long, prev: LockFreeLinkedListSegment): LockFreeLi

private const val SEGMENT_SIZE = 8

@JvmInline
private value class BrokenForSomeElements private constructor(val forbiddenBits: Byte) {
private class BrokenForSomeElements private constructor(val forbiddenBits: Byte) {
companion object {
fun fromBitmask(forbiddenBits: Byte): BrokenForSomeElements? = when (forbiddenBits) {
0.toByte() -> null // no one is forbidden
Expand Down