Skip to content

About fibers and cancellation #4181

Answered by armanbilge
Angel-O asked this question in Q&A
Discussion options

You must be logged in to vote

The Scala docs on .start say that it is an unsafe combinator wrt cancellation. If cancellation is not a concern (for instance if the started fiber does work that is finite, i.e. it won't run forever and perhaps shortlived or if I keep a handle on the fiber making sure to cancel it when needed) is it correct to say that .start is not unsafe

I would still say that start is unsafe . If you keep a handle to the fiber, that doesn't magically make start safe, that just means that you are doing the extra work to manage the fact that it's unsafe :)

if the started fiber does work that is finite, i.e. it won't run forever and perhaps shortlived

Even if the fiber is finite and short-lived, it ma…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Angel-O
Comment options

Answer selected by Angel-O
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants