Function EN Version 4.60

@CreateMutexSemaphore

Misc System Text

Syntax

@CreateMutexSemaphore(TEXTSEMAPHORENAME);

Description

Creates a mutex semaphore named TEXT TEXTSEMAPHORENAME.
On success, a 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: @CreateMutexSemaphore(TEXTSEMAPHORENAME);

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.