Skip to content
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

issue #38bugfix issue #38 enforce same thread #39

Merged
merged 2 commits into from
Feb 23, 2020

Conversation

patjackson52
Copy link
Contributor

#38 incorrectly throwing exception when interacting on same thread.

Appears coroutines appends "@coroutine#n" to the thread name, and this can change when suspending/resuming coroutines. The solution provided in this PR strips the coroutine name from the threadname. A test that fails without stripping the suffix has been added in ThreadUtilSpec.

Long term, handling of same thread enforcement may change - perhaps wrapping store in channel or actor. For now this should work, however all interactions with the store will need to be from a singleThreadCoroutine context, such as one with Dispatchers.Main or for native - https://github.com/reduxkotlin/ReadingListSampleApp/blob/master/common/src/iosMain/kotlin/org/reduxkotlin/readinglist/common/UI.kt
@jennymolske

@patjackson52 patjackson52 merged commit 402de3e into master Feb 23, 2020
@patjackson52 patjackson52 deleted the bugfix/38-thread-confinement branch April 5, 2020 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant