3.2. sync — Thread synchroniztion

Thread synchronization refers to the idea that multiple threads are to join up or handshake at a certain point, in order to reach an agreement or commit to a certain sequence of action.

Simba documentation: sync


class sync.Event

Initialize given event object.

Simba documentation: sync/event

read(mask)

Wait for an event to occur and return a mask of all active events.

write(mask)

Write given event(s) to the channel.

size()

Get the number of event(s) set in the channel.

class sync.Queue

Initialize given queue object.

Simba documentation: sync/queue

read(size)

Reads up to size number of bytes from the queue and returns them as a string. Raises an exception on error.

write(string)

Write given string to the queue. Returns the number of bytes written. Raises an exception on error.

size()

Get the number of bytes available to read.