Struct SemaphoreStream
Limits the number concurrent blocking operations using a semaphore.
struct SemaphoreStream(Stream, Semaphore, LockArgs...)
;
This stream can be used to wrap any type of stream in order to limit the amount of concurrent I/O operations across all streams that use the same semaphore. The main use for this is avoiding high concurrency overhead on I/O devices with bad random access performance, such as spinning hard disks.
Constructors
Name | Description |
---|---|
this
(stream, semaphore, lock_args)
|
Fields
Name | Type | Description |
---|---|---|
m_lockArgs
|
LockArgs | |
m_semaphore
|
Semaphore | |
m_stream
|
Stream |
Properties
Name | Type | Description |
---|---|---|
connected [get]
|
bool | |
dataAvailableForRead [get]
|
bool | |
empty [get]
|
bool | |
isOpen [get]
|
bool | |
leastSize [get]
|
ulong | |
readable [get]
|
bool | |
size [get]
|
ulong | |
writable [get]
|
bool |
Methods
Name | Description |
---|---|
close
()
|
|
close
()
|
|
finalize
()
|
|
flush
()
|
|
lock
()
|
|
peek
()
|
|
read
(dst, mode)
|
|
read
(dst)
|
|
seek
(offset)
|
|
tell
()
|
|
truncate
(size)
|
|
waitForData
(timeout)
|
|
write
(bytes, mode)
|
|
write
(bytes)
|
|
write
(bytes)
|