concurrent.el API¶
Generator¶
-
Function
cc:generatorcallback &rest body¶ Create a generator object. If BODY has
`yield'symbols, it means calling callback function CALLBACK.
Semaphore¶
-
Function
cc:semaphore-createpermits-num¶ Return a semaphore object with PERMITS-NUM permissions.
-
Function
cc:semaphore-acquiresemaphore¶ Acquire an execution permission and return deferred object to chain. If this semaphore object has permissions, the subsequent deferred task is executed immediately. If this semaphore object has no permissions, the subsequent deferred task is blocked. After the permission is returned, the task is executed.
-
Function
cc:semaphore-releasesemaphore¶ Release an execution permission. The programmer is responsible to return the permissions.
-
Function
cc:semaphore-withsemaphore body-func &optional error-func¶ Execute the task BODY-FUNC asynchronously with the semaphore block.
-
Function
cc:semaphore-release-allsemaphore¶ Release all permissions for resetting the semaphore object. If the semaphore object has some blocked tasks, this function return a list of the tasks and clear the list of the blocked tasks in the semaphore object.
-
Function
cc:semaphore-interrupt-allsemaphore¶ Clear the list of the blocked tasks in the semaphore and return a deferred object to chain. This function is used for the interruption cases.
Signal¶
-
Function
cc:signal-channel&optional name parent-channel¶ Create a channel. NAME is a channel name for debug. PARENT-CHANNEL is an upstream channel. The observers of this channel can receive the upstream signals. In the case of using the function
`cc:signal-send', the observers of the upstream channel can not receive the signals of this channel. The function`cc:signal-send-global'can send a signal to the upstream channels from the downstream channels.
-
Function
cc:signal-connectchannel event-sym &optional callback¶ Append an observer for EVENT-SYM of CHANNEL and return a deferred object. If EVENT-SYM is
`t', the observer receives all signals of the channel. If CALLBACK function is given, the deferred object executes the CALLBACK function asynchronously. One can connect subsequent tasks to the returned deferred object.
-
Function
cc:signal-sendchannel event-sym &rest args¶ Send a signal to CHANNEL. If ARGS values are given, observers can get the values by following code: (lambda (event) (destructuring-bind (event-sym (args)) event ... )).
-
Function
cc:signal-send-globalchannel event-sym &rest args¶ Send a signal to the most upstream channel.
-
Function
cc:signal-disconnectchannel deferred¶ Remove the observer object DEFERRED from CHANNEL and return the removed deferred object.
-
Function
cc:signal-disconnect-allchannel¶ Remove all observers.
Dataflow¶
-
Function
cc:dataflow-environment&optional parent-env test-func channel¶ Create a dataflow environment. PARENT-ENV is the default environment. If this environment doesn't have the entry A and the parent one has the entry A, this environment can return the entry A. One can override the entry, setting another entry A to this environment. TEST-FUNC is a test function that compares the entry keys. The default function is
`equal'. CHANNEL is a channel object that sends signals of variable events. Observers can receive following signals: ``get-first`` the fist referrer is waiting for binding ``get-waiting`` another referrer is waiting for binding ``set`` a value is bound ``get`` returned a bound value ``clear`` cleared one entry ``clear-all`` cleared all entries
-
Function
cc:dataflow-getdf key¶ Return a deferred object that can refer the value which is indicated by KEY. If DF has the entry that bound value, the subsequent deferred task is executed immediately. If not, the task is deferred till a value is bound.
-
Function
cc:dataflow-get-syncdf key¶ Return the value which is indicated by KEY synchronously. If the environment DF doesn't have an entry of KEY, this function returns nil.
-
Function
cc:dataflow-setdf key value¶ Bind the VALUE to KEY in the environment DF. If DF already has the bound entry of KEY, this function throws an error signal. VALUE can be nil as a value.
-
Function
cc:dataflow-cleardf key¶ Clear the entry which is indicated by KEY. This function does nothing for the waiting deferred objects.
-
Function
cc:dataflow-get-avalable-pairsdf¶ Return an available key-value alist in the environment DF and the parent ones.
-
Function
cc:dataflow-get-waiting-keysdf¶ Return a list of keys which have waiting deferred objects in the environment DF and the parent ones.
-
Function
cc:dataflow-clear-alldf¶ Clear all entries in the environment DF. This function does nothing for the waiting deferred objects.
-
Function
cc:dataflow-connectdf event-sym &optional callback¶ Append an observer for EVENT-SYM of the channel of DF and return a deferred object. See the docstring of
`cc:dataflow-environment'for details.