BuildForge Help

Semaphores

Use Administration > Semaphores to view job semaphores that are in use. You can also delete semaphores, which may be necessary when a hung or cancelled job fails to release its semaphore.

Semaphores are global signal flags in the system that set up mutually exclusive (mutex) resources. Use them to make some processes wait for other processes to finish.

You implement semaphores through a pair of dot commands: the .semget and .semput commands. Use the .semget command to "grab" a label: after a step gets a label, any other steps (in any project) that try to get the same label must wait until the original requester releases it.
Note: The effect of a semaphore is that a step that contains a .semget command hangs until the semaphore is released.

For example, suppose you have a program that creates a printer driver, and you want the program to be used by only one process at any one time. Within each project that calls the program, set up three steps with the following command lines:

Step

Command Line

Get semaphore

.semget $BF_PROJECTNAME_PHYS

Execute driver creator

printdrivermaker.exe windows

Release semaphore

.semput $BF_PROJECTNAME_PHYS

You can establish semaphores for key resources in your organization, such as a heavily loaded server or a software program with a single-user license. Every step that uses the resource you want to protect should be wrapped with .semget and .semput commands.

Semaphores obey the following rules: