threads

Experimental threads

moonbit
template
workflow
moon add mizchi/threads@0.1.2
Download zip
Author
Version
0.1.2
License
Apache-2.0
Last updated
5 months ago
Downloads
23

Dependencies

README

#mizchi/threads

Experimental multithread abstraction layer for MoonBit.

#Package

  • mizchi/threads

#Included Structure

  • Library package under src/
  • Executable package under src/main/
  • Test, benchmark, and doc-test examples

#Quick Example

import {
"mizchi/threads" @threads,
}

let t = @threads.threads_for_backend(@threads.backend_node_worker())
inspect(t.backend_kind, content="BackendNodeWorker")

#
AtomicOffset

type AtomicOffset = Int

#
EntryId

type EntryId = Int

#
SharedMemoryId

type SharedMemoryId = Int

#
StartArg

type StartArg = Int

#
TaskCond

A condition variable that can be used for synchronization between tasks.

#
TaskSemaphore

#
ThreadId

type ThreadId = Int

#
SharedStartArgDecoded

pub struct SharedStartArgDecoded {
memory_id : Int
local_arg : Int
}

#
atomic_ops_unsupported

#
backend_node_worker

#
backend_wasi_threads

#
multithread_platform_auto

#
multithread_platform_native_c

#
multithread_platform_node_worker

#
multithread_platform_wasi_threads

#
multithread_platform_web_worker

#
mutex_ops_unsupported

#
node_worker_capabilities

#
platform_capabilities

fn platform_capabilities(supports_join? : Bool, supports_detach? : Bool, supports_wait_timeout? : Bool, supports_blocking_wait_on_main_thread? : Bool) ->
PlatformCapabilities

#
registered_entry_double

#
registered_entry_from_id

fn registered_entry_from_id(entry_id : Int) ->
RegisteredEntry
?

#
registered_entry_increment

#
registered_entry_passthrough

#
registered_entry_shared_counter_add

fn registered_entry_shared_counter_add() ->
RegisteredEntry

#
registered_entry_shared_counter_mutex

fn registered_entry_shared_counter_mutex() ->
RegisteredEntry

#
registered_entry_to_id

fn registered_entry_to_id(entry :
RegisteredEntry
) -> Int

#
shared_memory

#
shared_start_arg_decode

fn shared_start_arg_decode(encoded : Int) -> SharedStartArgDecoded

#
shared_start_arg_encode

fn shared_start_arg_encode(memory_id : Int, local_arg : Int) -> Result[Int,
ThreadError
]

#
spawn_options

fn spawn_options(detached? : Bool, stack_size? : Int, name? : String) ->
SpawnOptions

#
spawn_spec

#
task_cond

#
task_cond_broadcast

fn task_cond_broadcast(cond :
Cond
) -> Unit

#
task_cond_signal

fn task_cond_signal(cond :
Cond
) -> Unit

#
task_cond_wait

async fn task_cond_wait(cond :
Cond
) -> Unit

#
task_pause

async fn task_pause() -> Unit

#
task_semaphore

fn task_semaphore(size : Int, initial_value? : Int) ->
Semaphore

#
task_semaphore_acquire

async fn task_semaphore_acquire(sem :
Semaphore
) -> Unit

#
task_semaphore_release

fn task_semaphore_release(sem :
Semaphore
) -> Unit

#
task_semaphore_try_acquire

fn task_semaphore_try_acquire(sem :
Semaphore
) -> Bool

#
thread_error_host_failure

fn thread_error_host_failure(message : String) ->
ThreadError

#
thread_error_resource_exhausted

fn thread_error_resource_exhausted() ->
ThreadError

#
thread_join_async

async fn thread_join_async(platform :
MultithreadPlatform
, thread_id : Int, poll_interval_ms? : Int) -> Result[Int,
ThreadError
]

#
thread_join_portable

async fn thread_join_portable(platform :
MultithreadPlatform
, thread_id : Int, poll_interval_ms? : Int) -> Result[Int,
ThreadError
]

#
thread_ops_unsupported

#
thread_spawn_join_portable

#
threads_join

async fn threads_join(threads :
MultithreadPlatform
, thread_id : Int, poll_interval_ms? : Int) -> Result[Int,
ThreadError
]

#
threads_join_blocking

#
threads_spawn_join

async fn threads_spawn_join(threads :
MultithreadPlatform
, entry_id : Int, start_arg : Int, options? :
SpawnOptions
, poll_interval_ms? : Int) -> Result[Int,
ThreadError
]

#
threads_spawn_join_blocking

#
wait_caller_main_thread

#
wait_caller_worker_thread

#
wait_not_equal

#
wait_timed_out

#
wasi_threads_capabilities

#
web_worker_capabilities

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io