summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/Network/lwip-new/vbox/include/arch/sys_arch.h
blob: 6a83cea36742ce07d2088bdba889448ccfc5f4db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef VBOX_ARCH_SYS_ARCH_H_
#define VBOX_ARCH_SYS_ARCH_H_

#include <iprt/semaphore.h>
#include <iprt/thread.h>
#ifdef RT_OS_DARWIN
#include <sys/time.h>
#endif

/** NULL value for a mbox. */
#define SYS_MBOX_NULL NULL

/** NULL value for a mutex semaphore. */
#define SYS_SEM_NULL NIL_RTSEMEVENT

/** The IPRT event semaphore ID just works fine for this type. */
typedef RTSEMEVENT sys_sem_t;


/** The opaque type of a mbox. */
typedef void *sys_mbox_t;

/** The IPRT thread ID just works fine for this type. */
typedef RTTHREAD sys_thread_t;

#if SYS_LIGHTWEIGHT_PROT
/** This is just a dummy. The implementation doesn't need anything. */
typedef void *sys_prot_t;
#endif

/** Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid */
int sys_mbox_valid(sys_mbox_t *mbox);
/** Set an mbox invalid so that sys_mbox_valid returns 0 */
void sys_mbox_set_invalid(sys_mbox_t *mbox);

#define sys_sem_valid(sem) ((sem) && (*(sem)))
#define sys_sem_set_invalid(sem) do {} while(0)

#endif /* !VBOX_ARCH_SYS_ARCH_H_ */