lock.h

A minimalistic platform agnostic lock abstraction for thread synchronization.

Includes

#include "azure_macro_utils/macro_utils.h"
#include "umock_c/umock_c_prod.h"

Detailed Description

The Lock component is implemented in order to achieve thread synchronization, as we may have a requirement to consume locks across different platforms. This component exposes some generic APIs so that it can be extended for platform specific implementations.

Functions

Function Name Description
LOCK_RESULTStrings
LOCK_RESULT_FromString
Lock_Init This API creates and returns a valid lock handle.
Lock Acquires a lock on the given lock handle. Uses platform specific mutex primitives in its implementation.
Unlock Releases the lock on the given lock handle. Uses platform specific mutex primitives in its implementation.
Lock_Deinit The lock instance is destroyed.

Macro definitions

LOCK_RESULT_VALUES

#define LOCK_RESULT_VALUES \
        LOCK_OK, \
        LOCK_ERROR 

Enumeration types

LOCK_RESULT

Enumeration specifying the lock status.

enum LOCK_RESULT {
  LOCK_RESULT_INVALID,
  LOCK_OK,
  LOCK_ERROR
}

Type definitions

LOCK_HANDLE

typedef void* LOCK_HANDLE;