interface::XFMutex Class Referenceabstract

Mutex interface needed by the XF to access a mutex. More...

`#include <mutex.h>`

Inheritance diagram for interface::XFMutex:
Collaboration diagram for interface::XFMutex:

## Public Member Functions

virtual void | lock ()=0
| Blocks until the mutex becomes available. More...
virtual void | unlock ()=0
| Releases the mutex so it can be taken by other threads. More...
virtual bool | tryLock (int32_t timeout=0)=0
| Tries to get the mutex. More...

## Static Public Member Functions

static XFMutex * | create ()
| Creates and returns a new mutex instance. More...

## Detailed Description

Mutex interface needed by the XF to access a mutex.

This interface only needs to be implemented for an XF port using an underlying OS. An IDF based XF does not need to provide a mutex.

A non-recursive mutex needs to be implemented.

## Member Function Documentation

## create()

interface::XFMutex * XFMutex::create | ( |  | ) |

static

Creates and returns a new mutex instance.

Implementation of interface::XFMutex::create method.

Returns
  Pointer to the created mutex object.

The implementation of this method needs to be provided by every XF port realizing a Mutex with this XFMutex interface. Best way is to implement this method in the mutex.cpp (or mutex-default.cpp) file of the XF port.

Attention: Do not forget to create an object of the class realizing the interface and then return this object.

You cannot instanciate an object of an abstract class!

## lock()

virtual void interface::XFMutex::lock | ( |  | ) |

pure virtual

Blocks until the mutex becomes available.

Implemented in XFMutex, and XFMutex.

## tryLock()

virtual bool interface::XFMutex::tryLock | ( | int32_t | timeout = `0` | ) |

pure virtual

Tries to get the mutex.

If timeout is 0 method will leave immediately and then the return parameter indicates it the mutex could be taken or not. Giving a negative value will block the thread until the mutex becomes available.

Implemented in XFMutex, and XFMutex.

## unlock()

virtual void interface::XFMutex::unlock | ( |  | ) |

pure virtual

Releases the mutex so it can be taken by other threads.

Implemented in XFMutex, and XFMutex.

The documentation for this class was generated from the following files:

- C:/Users/thomas.sterren/Desktop/PTR_XF_Release/03-release/work/src/simplified/xf/include/xf/interface/mutex.h
- C:/Users/thomas.sterren/Desktop/PTR_XF_Release/03-release/work/src/simplified/xf/port/idf-qt/mutex.cpp
- C:/Users/thomas.sterren/Desktop/PTR_XF_Release/03-release/work/src/simplified/xf/port/idf-stm32/mutex.cpp