Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cond_var/cond_var.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ priv struct Waiter {

///|
/// A condition variable that can be used for synchronization between tasks.
#valtype
struct Cond {
waiters : @deque.Deque[Waiter]
}
Expand Down
4 changes: 2 additions & 2 deletions src/internal/coroutine/coroutine.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
// limitations under the License.

///|
priv enum State {
enum State {
Done
Fail(Error)
Running
Suspend(ok_cont~ : (Unit) -> Unit, err_cont~ : (Error) -> Unit)
}

///|
struct Coroutine {
pub struct Coroutine {
coro_id : Int
mut state : State
mut shielded : Bool
Expand Down
12 changes: 11 additions & 1 deletion src/internal/coroutine/pkg.generated.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package "moonbitlang/async/internal/coroutine"

import {
"moonbitlang/core/debug",
"moonbitlang/core/set",
}

// Values
Expand Down Expand Up @@ -32,7 +33,14 @@ pub(all) suberror Cancelled derive(@debug.Debug)
pub impl Show for Cancelled

// Types and methods
type Coroutine
pub struct Coroutine {
coro_id : Int
mut state : State
mut shielded : Bool
mut cancelled : Bool
mut ready : Bool
downstream : @set.Set[Coroutine]
}
pub fn Coroutine::cancel(Self) -> Unit
pub fn Coroutine::check_error(Self) -> Unit raise
pub fn Coroutine::unwrap(Self) -> Unit raise
Expand All @@ -41,6 +49,8 @@ pub fn Coroutine::wake(Self) -> Unit
pub impl Eq for Coroutine
pub impl Hash for Coroutine

type State

// Type aliases

// Traits
Expand Down
1 change: 1 addition & 0 deletions src/task.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
///|
/// `Task[X]` represents a running task with result type `X`,
/// it can be used to wait and retrieve the result value of the task.
#valtype
struct Task[X] {
value : Ref[X?]
coro : @coroutine.Coroutine
Expand Down
Loading