Skip to content

Commit 72e0195

Browse files
committed
Protected xxxUpdateState funs in JobSupport instead of internal ones
1 parent daa1d9d commit 72e0195

File tree

1 file changed

+10
-4
lines changed
  • kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental

1 file changed

+10
-4
lines changed

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/Job.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,23 +368,29 @@ public open class JobSupport(active: Boolean) : AbstractCoroutineContextElement(
368368
}
369369

370370
/**
371-
* Tries to update current [state] of this job.
371+
* Updates current [state] of this job.
372372
*/
373-
internal fun updateState(expect: Any, update: Any?, mode: Int): Boolean {
373+
protected fun updateState(expect: Any, update: Any?, mode: Int): Boolean {
374374
if (!tryUpdateState(expect, update)) return false
375375
completeUpdateState(expect, update, mode)
376376
return true
377377
}
378378

379-
internal fun tryUpdateState(expect: Any, update: Any?): Boolean {
379+
/**
380+
* Tries to initiate update of the current [state] of this job.
381+
*/
382+
protected fun tryUpdateState(expect: Any, update: Any?): Boolean {
380383
require(expect is Incomplete && update !is Incomplete) // only incomplete -> completed transition is allowed
381384
if (!STATE.compareAndSet(this, expect, update)) return false
382385
// Unregister from parent job
383386
parentHandle?.dispose() // volatile read parentHandle _after_ state was updated
384387
return true // continues in completeUpdateState
385388
}
386389

387-
internal fun completeUpdateState(expect: Any, update: Any?, mode: Int) {
390+
/**
391+
* Completes update of the current [state] of this job.
392+
*/
393+
protected fun completeUpdateState(expect: Any, update: Any?, mode: Int) {
388394
// Invoke completion handlers
389395
val cause = (update as? CompletedExceptionally)?.cause
390396
var completionException: Throwable? = null

0 commit comments

Comments
 (0)