Program Listing for File mutex.h

Return to documentation for file (rcsw/multithread/mutex.h)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <pthread.h>
#include "rcsw/rcsw.h"

/*******************************************************************************
 * Type Definitions
 ******************************************************************************/
struct mutex {
  pthread_mutex_t impl;

  uint32_t flags;
};

/*******************************************************************************
 * API Functions
 ******************************************************************************/
BEGIN_C_DECLS

RCSW_API struct mutex* mutex_init(struct mutex *mutex_in, uint32_t flags);

RCSW_API void mutex_destroy(struct mutex *mutex);

RCSW_API status_t mutex_lock(struct mutex *mutex);

RCSW_API status_t mutex_unlock(struct mutex *mutex);

END_C_DECLS