#include "./Platform.h"
#include <pthread.h>
#include <errno.h>
Go to the source code of this file.
- Todo
- Give a way for err-handling
Definition in file Lock.h.
◆ __ae2f_osx_wait
#define __ae2f_osx_wait |
( |
| uaddr, |
|
|
| v ) |
Value: ({ int __ret = 0; \
if (pthread_mutex_lock(&__ae2f_osx_mutex) != 0) { \
errno = EAGAIN; \
__ret = -1; \
} else { \
while (*(uaddr) == (v) && __ret == 0) { \
if (pthread_cond_wait(&__ae2f_osx_cond, &__ae2f_osx_mutex) != 0) { \
errno = EAGAIN; \
__ret = -1; \
} \
} \
if (pthread_mutex_unlock(&__ae2f_osx_mutex) != 0) { \
errno = EAGAIN; \
__ret = -1; \
} \
} \
__ret; })
Wait on uaddr if its value equals v.
- Parameters
-
uaddr | Pointer to address to wait on. |
v | Value to compare against. |
- Returns
- 0 on success, -1 on error with errno set.
Definition at line 125 of file Lock.h.
◆ __ae2f_osx_wakesingle
#define __ae2f_osx_wakesingle |
( |
| uaddr | ) |
|
Value: ({ int __ret = 0; \
if (pthread_mutex_lock(&__ae2f_osx_mutex) != 0) { \
errno = EAGAIN; \
__ret = -1; \
} else { \
if (pthread_cond_signal(&__ae2f_osx_cond) != 0) { \
errno = EAGAIN; \
__ret = -1; \
} \
if (pthread_mutex_unlock(&__ae2f_osx_mutex) != 0) { \
errno = EAGAIN; \
__ret = -1; \
} \
} \
__ret; })
Wake one thread waiting on uaddr.
- Parameters
-
uaddr | Pointer to address (unused, wakes condition variable). |
- Returns
- 0 on success, -1 on error with errno set.
Definition at line 149 of file Lock.h.
◆ __ae2f_Wait
◆ __ae2f_WakeSingle
◆ ae2f_addrel_t
Address element type.
Definition at line 111 of file Lock.h.