FunctionPackage: mpToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
New since 8.2 release.

make-sharable-lock

Arguments: &key name max-shared yield-rate recursive-p safe-p auto-unlock-p

This function returns a fresh instance of a sharable-lock.

The name argument must be a string or nil. The name is used in status and error messages.

The max-shared argument must be an integer greater than zero; it specifies the maximum number of simultaneous shared users allowed at any moment. The default value is 20. The size of the instance is proportional to this number. Values as high as 1000 still perform reasonably well, but much larger values may degrade performance noticably.

The yield-rate argument must be an integer greater than zero; it specifies how often a spin loop should yield. The default value is 5. Most of the low-level locking in SMP code is done with spin loops testing control bits. Such loops are very effective for short delays since they do not involve any operating system delays. However, if longer delays can occur, especially when the number of active threads is greater than the number of available processors, then spin loops can consume large amounts of cpu time with very little benefit. When a value of n is specified for yield rate, sharable-lock spin loops yield control every n-th iteration so that other threads may run and possibly release the needed resource sooner. If the yield-rate is specified as :never, then no yield is done at all.

The recursive-p argument specifies the behavior when a lock is locked recursively. The default value is t. When nil, a recursive attempt to lock a sharable-lock signals an error. When non-nil, recursive locking calls increment a counter and unlock calls decrement a counter. The lock is actually released when the count is zero.

The safe-p argument specifies the behavior if an attempt is made to unlock a lock that is already unlocked. The default value is t. When the value is non-nil, an error is signaled if an attempt is made to unlock a lock that is already unlocked. When the value is nil, the attempt is ignored silently.

The auto-unlock-p argument specifies the behavior if the locking process is terminated without releasing the lock. The default value is nil. When the value is nil, nothing is done. When the value is non-nil, a lock held by a terminated process is automatically released when competition for the lock occurs.

See Sharable locks in smp.htm.

See multiprocessing.htm for general information on multiprocessing in Allegro CL.


Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page is new in the 8.2 release.
Created 2016.6.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
New since 8.2 release.