mirror of
https://github.com/xenia-project/xenia.git
synced 2024-11-30 15:00:25 +00:00
Compiling on linux.
This commit is contained in:
parent
3cae7ed714
commit
bfda368ab5
@ -95,7 +95,7 @@
|
||||
],
|
||||
|
||||
'cflags': [
|
||||
'-std=c99',
|
||||
#'-std=c99',
|
||||
],
|
||||
|
||||
'configurations': {
|
||||
|
@ -69,7 +69,16 @@ XEFORCEINLINE void* xe_atomic_stack_dequeue(xe_atomic_stack_t* stack,
|
||||
|
||||
#elif XE_LIKE(POSIX)
|
||||
|
||||
#error TODO(benvanik): POSIX atomic primitives
|
||||
#define xe_atomic_inc_32(value) \
|
||||
__sync_add_and_fetch(value, 1)
|
||||
#define xe_atomic_dec_32(value) \
|
||||
__sync_sub_and_fetch(value, 1)
|
||||
#define xe_atomic_add_32(amount, value) \
|
||||
__sync_fetch_and_add(value, amount)
|
||||
#define xe_atomic_sub_32(amount, value) \
|
||||
__sync_fetch_and_sub(value, amount)
|
||||
#define xe_atomic_cas_32(oldValue, newValue, value) \
|
||||
__sync_bool_compare_and_swap(value, oldValue, newValue)
|
||||
|
||||
#else
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
#define XESWAP32 OSSwapInt32
|
||||
#define XESWAP64 OSSwapInt64
|
||||
#else
|
||||
#define XESWAP16 bswap_16
|
||||
#define XESWAP32 bswap_32
|
||||
#define XESWAP64 bswap_64
|
||||
#define XESWAP16 __bswap_16
|
||||
#define XESWAP32 __bswap_32
|
||||
#define XESWAP64 __bswap_64
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -185,7 +185,7 @@ int xe_socket_loop_poll(xe_socket_loop_t* loop,
|
||||
XEIGNORE(recv(loop->notify_rd_id, &dummy, 1, 0));
|
||||
}
|
||||
loop->events[1].revents = 0;
|
||||
loop->events[1].events = POLL_IN;
|
||||
loop->events[1].events = POLLIN;
|
||||
|
||||
// Check send/recv.
|
||||
loop->pending_recv = (loop->events[0].revents & POLLIN) != 0;
|
||||
|
@ -109,7 +109,11 @@ int xe_thread_start(xe_thread_ref thread) {
|
||||
|
||||
static void* xe_thread_callback_pthreads(void* param) {
|
||||
xe_thread_t* thread = reinterpret_cast<xe_thread_t*>(param);
|
||||
#if XE_LIKE(OSX)
|
||||
XEIGNORE(pthread_setname_np(thread->name));
|
||||
#else
|
||||
pthread_setname_np(pthread_self(), thread->name);
|
||||
#endif // OSX
|
||||
thread->callback(thread->callback_param);
|
||||
return 0;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#if XE_PLATFORM(WIN32)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
|
@ -186,11 +186,16 @@ X_STATUS XThread::PlatformCreate() {
|
||||
|
||||
int result_code;
|
||||
if (creation_params_.creation_flags & X_CREATE_SUSPENDED) {
|
||||
#if XE_PLATFORM(OSX)
|
||||
result_code = pthread_create_suspended_np(
|
||||
reinterpret_cast<pthread_t*>(&thread_handle_),
|
||||
&attr,
|
||||
&XThreadStartCallbackPthreads,
|
||||
this);
|
||||
#else
|
||||
// TODO(benvanik): pthread_create_suspended_np on linux
|
||||
XEASSERTALWAYS();
|
||||
#endif // OSX
|
||||
} else {
|
||||
result_code = pthread_create(
|
||||
reinterpret_cast<pthread_t*>(&thread_handle_),
|
||||
|
@ -153,7 +153,7 @@ int xe_main_thunk(
|
||||
void* user_main, const char* usage);
|
||||
#define XE_MAIN_THUNK(NAME, USAGE) \
|
||||
int main(int argc, char **argv) { \
|
||||
return xe_main_thunk(argc, argv, NAME, USAGE); \
|
||||
return xe_main_thunk(argc, argv, (void*)NAME, USAGE); \
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
|
@ -33,6 +33,11 @@
|
||||
#pragma warning(disable : 4068)
|
||||
#endif // MSVC
|
||||
|
||||
#if XE_LIKE(POSIX)
|
||||
#include <unistd.h>
|
||||
#include <endian.h>
|
||||
#endif // POSIX
|
||||
|
||||
#include <stddef.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
Loading…
Reference in New Issue
Block a user