Commit a08bf241 authored by Him188's avatar Him188

Improve event handler coroutine management

parent 9fdc8cd9
...@@ -29,8 +29,8 @@ internal fun <E : Event> Class<E>._subscribeEventForJaptOnly( ...@@ -29,8 +29,8 @@ internal fun <E : Event> Class<E>._subscribeEventForJaptOnly(
): Listener<E> { ): Listener<E> {
return this.kotlin.subscribeInternal( return this.kotlin.subscribeInternal(
scope.Handler( scope.Handler(
EmptyCoroutineContext, scope.coroutineContext,
Listener.ConcurrencyKind.CONCURRENT Listener.ConcurrencyKind.LOCKED
) { withContext(Dispatchers.IO) { onEvent.apply(it) } }) ) { withContext(Dispatchers.IO) { onEvent.apply(it) } })
} }
...@@ -39,6 +39,6 @@ internal fun <E : Event> Class<E>._subscribeEventForJaptOnly(scope: CoroutineSco ...@@ -39,6 +39,6 @@ internal fun <E : Event> Class<E>._subscribeEventForJaptOnly(scope: CoroutineSco
return this.kotlin.subscribeInternal( return this.kotlin.subscribeInternal(
scope.Handler( scope.Handler(
EmptyCoroutineContext, EmptyCoroutineContext,
Listener.ConcurrencyKind.CONCURRENT Listener.ConcurrencyKind.LOCKED
) { withContext(Dispatchers.IO) { onEvent.accept(it) }; ListeningStatus.LISTENING; }) ) { withContext(Dispatchers.IO) { onEvent.accept(it) }; ListeningStatus.LISTENING; })
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment