trait Fiber[+E, +A] extends AnyRef
A fiber is a lightweight thread of execution that never consumes more than a
whole thread (but may consume much less, depending on contention). Fibers are
spawned by forking IO actions, which, conceptually at least, runs them
concurrently with the parent IO action.
Fibers can be joined, yielding their result other fibers, or interrupted, which terminates the fiber with a runtime error.
Fork-Join Identity: fork >=> join = id
for { fiber1 <- io1.fork fiber2 <- io2.fork _ <- fiber1.interrupt(e) a <- fiber2.join } yield a
- Self Type
- Fiber[E, A]
- Alphabetic
- By Inheritance
- Fiber
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
interrupt0(ts: List[Throwable]): IO[Nothing, Unit]
Interrupts the fiber with a list of error(s).
-
abstract
def
join: IO[E, A]
Joins the fiber, with suspends the joining fiber until the result of the fiber has been determined.
Joins the fiber, with suspends the joining fiber until the result of the fiber has been determined. Attempting to join a fiber that has been or is killed before producing its result will result in a catchable error.
-
abstract
def
onComplete(f: (ExitResult[E, A]) ⇒ IO[Nothing, Unit]): IO[Nothing, Unit]
Add an exit handler for when the fiber terminates and receive information on whether the fiber terminated normally, with unhandled error, or with exception.
Add an exit handler for when the fiber terminates and receive information on whether the fiber terminated normally, with unhandled error, or with exception.
The specified action will be invoked after the fiber has finished running (including all finalizers). If the specified action throws an exception, it will be reported to the parent fiber's unhandled error handler.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
*>[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, B]
Same as
zipbut discards the output of the left hand side. -
final
def
<*[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, A]
Same as
zipbut discards the output of the right hand side. -
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
interrupt(t: Throwable, ts: Throwable*): IO[Nothing, Unit]
Interrupts the fiber with the specified error(s).
Interrupts the fiber with the specified error(s). If the fiber has already terminated, either successfully or with error, this will resume immediately. Otherwise, it will resume when the fiber has been successfully interrupted or has produced its result.
-
def
interrupt: IO[Nothing, Unit]
Interrupts the fiber with no specified reason.
Interrupts the fiber with no specified reason. If the fiber has already terminated, either successfully or with error, this will resume immediately. Otherwise, it will resume when the fiber has been successfully interrupted or has produced its result.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
map[B](f: (A) ⇒ B): Fiber[E, B]
Maps over the value the Fiber computes.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
zip[E1 >: E, B](that: ⇒ Fiber[E1, B]): Fiber[E1, (A, B)]
Zips this fiber and the specified fiber togther, producing a tuple of their output.
-
final
def
zipWith[E1 >: E, B, C](that: ⇒ Fiber[E1, B])(f: (A, B) ⇒ C): Fiber[E1, C]
Zips this fiber with the specified fiber, combining their results using the specified combiner function.
Zips this fiber with the specified fiber, combining their results using the specified combiner function. Both joins and interruptions are performed in sequential order from left to right.