Function EN Version 4.60

@CloseMutexSemaphore

Misc System Text

Syntax

@CloseMutexSemaphore(MUTEXSEMAPHOREHANDLE);

Description

Closes the mutex semaphore with the mutex semaphore handle (MSH) MUTEXSEMAPHOREHANDLE.
On success a closed mutex semaphore-Handle (MSH) is returned, otherwise @ERROR.

A mutex semaphore can be owned (requested) by only one task at a time.
(This is used to allow certain parts of a script to be executed exclusively by only one task at a time.)

For example, access to a GLOBAL counter variable that is to be continuously incremented by several tasks.

Example: @CloseMutexSemaphore(MUTEXSEMAPHOREHANDLE);

TEXTSEMAPHORENAME:="TEST_SEMAPHORE_NAME";

MSH:=@CreateMutexSemaphore(TEXTSEMAPHORENAME);
@RequestMutexSemaphore(MSH);

@ReleaseMutexSemaphore(MSH);
MSH:=@CloseMutexSemaphore(MSH);

A mutex semaphore named "TEST_SEMAPHORE_NAME" is created, requested (claimed and locked), released, and closed again.

Note : This text was machine-translated and may contain inaccuracies.