← Back to the index

Module std/sync.vv

sync モジュールは、相互排他ロックなどの基本的な同期プリミティブを提供します。

Example:

import sync from "std/sync.vv"
let m = sync.mutex()
sync.lock(m)
defer sync.unlock(m)

Table of Contents

Exports

fun mutex() extern "native"

新しいミューテックスを作成します。

Example:

let m = sync.mutex()

fun lock(m) extern "native"

ミューテックス m をロックします。すでにロックされている場合、ミューテックスが利用可能になるまで呼び出し元のタスクをブロックします。

Example:

sync.lock(m)

fun unlock(m) extern "native"

ミューテックス m のロックを解除します。

Example:

sync.unlock(m)