SharedMemoryPollingSource

class SharedMemoryPollingSource(reader: SharedMemoryReader, pollingIntervalMs: Long, reconnectIntervalMs: Long, scope: CoroutineScope)

SharedMemoryReader を一定間隔でポーリングし、読み取ったバッファを bufferFlow として配信する。 open/close の排他制御用に単一の Mutex を保持しており、withReaderLock を通じて 呼び出し元固有の追加処理(接続判定など)を同じ排他制御の下で安全に行える。

Constructors

Link copied to clipboard
constructor(reader: SharedMemoryReader, pollingIntervalMs: Long, reconnectIntervalMs: Long, scope: CoroutineScope)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
suspend fun <T> withReaderLock(block: suspend (SharedMemoryReader) -> T): T

bufferFlow のポーリングループと同じ Mutex の下で reader を操作する。 接続判定・切断など、reader の open/close を伴う追加処理をポーリングループと 競合させずに実行するために使用する。