Queues and Resources

cimba.UNLIMITED

Capacity sentinel for buffers and queues with no practical size limit.

class cimba.Buffer(name, capacity=None)

Numeric fixed-capacity buffer with blocking put/get semantics.

name
capacity
level
space
put(amount=1)

Put an amount into the buffer, waiting for space if needed. Returns (signal, remaining).

get(amount=1)

Get an amount from the buffer, waiting for content if needed. Returns (signal, obtained).

start_recording()
stop_recording()
history()
close()
class cimba.ObjectQueue(name, capacity=None)

FIFO queue for Python objects.

name
capacity
length
space
put(obj)
get()
position(obj)
start_recording()
stop_recording()
history()
close()
class cimba.PriorityQueue(name, capacity=None)

Priority queue for Python objects.

name
capacity
length
space
put(obj, priority=0)
get()
position(handle)
cancel(handle)
reprioritize(handle, priority)
start_recording()
stop_recording()
history()
close()
class cimba.Resource(name)

Binary semaphore resource.

name
in_use
available
acquire()
preempt()
release()
held_by(process)
start_recording()
stop_recording()
history()
close()
class cimba.ResourcePool(name, capacity)

Counting semaphore resource pool.

name
capacity
in_use
available
acquire(amount=1)
preempt(amount=1)
release(amount=1)
held_by(process)
start_recording()
stop_recording()
history()
close()
class cimba.Condition(name)

Condition variable for arbitrary Python predicates.

wait(predicate, context=None)

Wait until predicate(process, context) returns true.

signal()

Evaluate waiting predicates and reactivate those that are true.

subscribe(*sources, on=None)

Forward native resource-guard signals from resources, buffers, or queues to this condition. on=None observes the single guard for Resource and ResourcePool, and both "front" and "rear" guards for Buffer, ObjectQueue, and PriorityQueue.

unsubscribe(*sources, on=None)

Stop forwarding native signals from the given sources. Returns the number of subscriptions removed.

cancel(process)

Remove process from this condition and wake it with cimba.CANCELLED.

remove(process)

Remove process from this condition without waking it.

close()