some fixes to the places code
svn: r11230
This commit is contained in:
parent
7a6feab38c
commit
012cf40a15
|
@ -119,7 +119,7 @@ MZ_INLINE uint32_t mzrt_atomic_add_32(volatile unsigned int *counter, unsigned i
|
||||||
return InterlockedExchangeAdd(counter, value);
|
return InterlockedExchangeAdd(counter, value);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#elif defined (__GNUC__) && (__i386__)
|
#elif defined (__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||||
asm volatile ("lock; xaddl %0,%1"
|
asm volatile ("lock; xaddl %0,%1"
|
||||||
: "=r" (value), "=m" (*counter)
|
: "=r" (value), "=m" (*counter)
|
||||||
: "0" (value), "m" (*counter)
|
: "0" (value), "m" (*counter)
|
||||||
|
@ -139,19 +139,13 @@ MZ_INLINE uint32_t mzrt_atomic_incr_32(volatile unsigned int *counter) {
|
||||||
/* Threads */
|
/* Threads */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
typedef struct {
|
struct mz_proc_thread {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
HANDLE threadid;
|
HANDLE threadid;
|
||||||
#else
|
#else
|
||||||
pthread_t threadid;
|
pthread_t threadid;
|
||||||
#endif
|
#endif
|
||||||
} mz_proc_thread;
|
};
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
typedef DWORD (WINAPI *mz_proc_thread_start)(void*);
|
|
||||||
#else
|
|
||||||
typedef void *(mz_proc_thread_start)(void*);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mz_proc_thread* mz_proc_thread_create(mz_proc_thread_start start_proc, void* data) {
|
mz_proc_thread* mz_proc_thread_create(mz_proc_thread_start start_proc, void* data) {
|
||||||
mz_proc_thread *thread = (mz_proc_thread*)malloc(sizeof(mz_proc_thread));
|
mz_proc_thread *thread = (mz_proc_thread*)malloc(sizeof(mz_proc_thread));
|
||||||
|
@ -200,9 +194,9 @@ void * mz_proc_thread_wait(mz_proc_thread *thread) {
|
||||||
START_XFORM_SUSPEND;
|
START_XFORM_SUSPEND;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct mzrt_rwlock {
|
struct mzrt_rwlock {
|
||||||
pthread_rwlock_t lock;
|
pthread_rwlock_t lock;
|
||||||
} mzrt_rwlock;
|
};
|
||||||
|
|
||||||
int mzrt_rwlock_create(mzrt_rwlock **lock) {
|
int mzrt_rwlock_create(mzrt_rwlock **lock) {
|
||||||
*lock = malloc(sizeof(mzrt_rwlock));
|
*lock = malloc(sizeof(mzrt_rwlock));
|
||||||
|
|
|
@ -24,7 +24,13 @@ void mzrt_set_user_break_handler(void (*user_break_handler)(int));
|
||||||
/****************** PROCESS WEIGHT THREADS ********************************/
|
/****************** PROCESS WEIGHT THREADS ********************************/
|
||||||
/* mzrt_threads.c */
|
/* mzrt_threads.c */
|
||||||
typedef struct mz_proc_thread mz_proc_thread; /* OPAQUE DEFINITION */
|
typedef struct mz_proc_thread mz_proc_thread; /* OPAQUE DEFINITION */
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
typedef DWORD (WINAPI *mz_proc_thread_start)(void*);
|
||||||
|
#else
|
||||||
typedef void *(mz_proc_thread_start)(void*);
|
typedef void *(mz_proc_thread_start)(void*);
|
||||||
|
#endif
|
||||||
|
|
||||||
mz_proc_thread* mz_proc_thread_create(mz_proc_thread_start*, void* data);
|
mz_proc_thread* mz_proc_thread_create(mz_proc_thread_start*, void* data);
|
||||||
void *mz_proc_thread_wait(mz_proc_thread *thread);
|
void *mz_proc_thread_wait(mz_proc_thread *thread);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user