• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • OSAPIMutexLocker
  • 4.11.14

OSAPIMutexLocker Class

The OSAPIMutexLocker is used for handling automatic unlocking of a mutex when it goes out of scope. More...

Header: #include <OSAPI/Process/OSAPISemaphore.h>
  • List of all members, including inherited members

Public Functions

OSAPIMutexLocker(const OSAPIMutex &mutex, const char *pzCaller = "")
virtual ~OSAPIMutexLocker()
bool IsLocked()
void Lock()
void Release()

Detailed Description

The OSAPIMutexLocker is used for handling automatic unlocking of a mutex when it goes out of scope.

A class for handling automatic unlocking of a mutex when it goes out of scope. Note that if the mutex is already released when it goes out of scope, Release() on the mutex will not be called.

Excellent for using in code with several exit-options or code that might throw exceptions.

Usage

{
  OSAPIMutexLocker locker(m_mutex);   // will lock m_mutex
  ...
  ...
} // Mutex will be unlocked automaticallly here as the OSAPIMutexLocker instance goes out of scope.

See also OSAPIMutex.

Member Function Documentation

OSAPIMutexLocker::OSAPIMutexLocker(const OSAPIMutex &mutex, const char *pzCaller = "")

Constructs an OSAPIMutexLocker

[virtual] OSAPIMutexLocker::~OSAPIMutexLocker()

Destructs the OSAPIMutexLocker.

bool OSAPIMutexLocker::IsLocked()

Returns true if the mutex has been locked through OSAPIMutexLocker.

void OSAPIMutexLocker::Lock()

Locks the mutex.

void OSAPIMutexLocker::Release()

Releases the mutex.

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

    © Copyright 2022 CDP Technologies. Privacy and cookie policy.

    Return to top