Commit 2380b26d authored by Ian Craggs's avatar Ian Craggs

Add WIN64 to WIN32 conditional compilation statements

parent 72fe69ea
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -21,7 +21,7 @@
#include <time.h>
#if defined(OPENSSL)
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#include "winsock2.h"
#endif
#include <openssl/ssl.h>
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -43,7 +43,7 @@ char* Broker_recordFFDC(char* symptoms);
#undef realloc
#undef free
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
mutex_type heap_mutex;
#else
static pthread_mutex_t heap_mutex_store = PTHREAD_MUTEX_INITIALIZER;
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -37,7 +37,7 @@
#include <time.h>
#include <string.h>
#if !defined(WIN32)
#if !defined(WIN32) && !defined(WIN64)
#include <syslog.h>
#include <sys/stat.h>
#define GETTIMEOFDAY 1
......@@ -51,7 +51,7 @@
#include <sys/timeb.h>
#endif
#if !defined(WIN32)
#if !defined(WIN32) && !defined(WIN64)
/**
* _unlink mapping for linux
*/
......@@ -112,7 +112,7 @@ struct timeb ts, last_ts;
#endif
static char msg_buf[512];
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
mutex_type log_mutex;
#else
static pthread_mutex_t log_mutex_store = PTHREAD_MUTEX_INITIALIZER;
......@@ -171,7 +171,7 @@ int Log_initialize(Log_nameValue* info)
info++;
}
}
#if !defined(WIN32)
#if !defined(WIN32) && !defined(WIN64)
struct stat buf;
if (stat("/proc/version", &buf) != -1)
{
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -72,7 +72,7 @@ enum MQTTAsync_threadStates
enum MQTTAsync_threadStates sendThread_state = STOPPED;
enum MQTTAsync_threadStates receiveThread_state = STOPPED;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
static mutex_type mqttasync_mutex = NULL;
static mutex_type mqttcommand_mutex = NULL;
static sem_type send_sem = NULL;
......@@ -148,7 +148,7 @@ void MQTTAsync_closeSession(Clients* client);
void MQTTProtocol_closeSession(Clients* client, int sendwill);
void MQTTAsync_writeComplete(int socket);
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define START_TIME_TYPE DWORD
START_TIME_TYPE MQTTAsync_start_clock(void)
{
......@@ -173,7 +173,7 @@ START_TIME_TYPE MQTTAsync_start_clock(void)
#endif
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
long MQTTAsync_elapsed(DWORD milliseconds)
{
return GetTickCount() - milliseconds;
......@@ -296,7 +296,7 @@ int MQTTAsync_restoreMessageQueue(MQTTAsyncs* client);
void MQTTAsync_sleep(long milliseconds)
{
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
Sleep(milliseconds);
#else
usleep(milliseconds*1000);
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -78,7 +78,7 @@
#if !defined(MQTTASYNC_H)
#define MQTTASYNC_H
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define DLLImport __declspec(dllimport)
#define DLLExport __declspec(dllexport)
#else
......@@ -1174,7 +1174,7 @@ int main(int argc, char* argv[])
"on topic %s for client with ClientID: %s\n",
PAYLOAD, TOPIC, CLIENTID);
while (!finished)
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
Sleep(100);
#else
usleep(10000L);
......@@ -1324,7 +1324,7 @@ int main(int argc, char* argv[])
}
while (!subscribed)
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
Sleep(100);
#else
usleep(10000L);
......@@ -1345,7 +1345,7 @@ int main(int argc, char* argv[])
exit(-1);
}
while (!disc_finished)
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
Sleep(100);
#else
usleep(10000L);
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -68,7 +68,7 @@ ClientStates* bstate = &ClientState;
MQTTProtocol state;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
static mutex_type mqttclient_mutex = NULL;
extern mutex_type stack_mutex;
extern mutex_type heap_mutex;
......@@ -161,7 +161,7 @@ typedef struct
void MQTTClient_sleep(long milliseconds)
{
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
Sleep(milliseconds);
#else
usleep(milliseconds*1000);
......@@ -170,7 +170,7 @@ void MQTTClient_sleep(long milliseconds)
}
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define START_TIME_TYPE DWORD
START_TIME_TYPE MQTTClient_start_clock(void)
{
......@@ -195,7 +195,7 @@ START_TIME_TYPE MQTTClient_start_clock(void)
#endif
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
long MQTTClient_elapsed(DWORD milliseconds)
{
return GetTickCount() - milliseconds;
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -99,7 +99,7 @@
#if !defined(MQTTCLIENT_H)
#define MQTTCLIENT_H
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define DLLImport __declspec(dllimport)
#define DLLExport __declspec(dllexport)
#else
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -32,7 +32,7 @@
#include <string.h>
#include <errno.h>
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#include <windows.h>
#include <direct.h>
/* Windows doesn't have strtok_r, so remap it to strtok */
......@@ -122,7 +122,7 @@ int pstmkdir( char *pPathname )
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
if ( _mkdir( pPathname ) != 0 )
{
#else
......@@ -262,7 +262,7 @@ int pstremove(void* handle, char* key)
file = malloc(strlen(clientDir) + strlen(key) + strlen(MESSAGE_FILENAME_EXTENSION) + 2);
sprintf(file, "%s/%s%s", clientDir, key, MESSAGE_FILENAME_EXTENSION);
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
if ( _unlink(file) != 0 )
{
#else
......@@ -296,7 +296,7 @@ int pstclose(void* handle)
goto exit;
}
#if defined (WIN32)
#if defined(WIN32) || defined(WIN64)
if ( _rmdir(clientDir) != 0 )
{
#else
......@@ -330,7 +330,7 @@ int pstcontainskey(void *handle, char *key)
goto exit;
}
#if defined (WIN32)
#if defined(WIN32) || defined(WIN64)
rc = containskeyWin32(clientDir, key);
#else
rc = containskeyUnix(clientDir, key);
......@@ -342,7 +342,7 @@ exit:
}
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
int containskeyWin32(char *dirname, char *key)
{
int notFound = MQTTCLIENT_PERSISTENCE_ERROR;
......@@ -440,7 +440,7 @@ int pstclear(void *handle)
goto exit;
}
#if defined (WIN32)
#if defined(WIN32) || defined(WIN64)
rc = clearWin32(clientDir);
#else
rc = clearUnix(clientDir);
......@@ -452,7 +452,7 @@ exit:
}
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
int clearWin32(char *dirname)
{
int rc = 0;
......@@ -540,7 +540,7 @@ int pstkeys(void *handle, char ***keys, int *nkeys)
goto exit;
}
#if defined (WIN32)
#if defined(WIN32) || defined(WIN64)
rc = keysWin32(clientDir, keys, nkeys);
#else
rc = keysUnix(clientDir, keys, nkeys);
......@@ -552,7 +552,7 @@ exit:
}
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
int keysWin32(char *dirname, char ***keys, int *nkeys)
{
int rc = 0;
......
/*******************************************************************************
* Copyright (c) 2012, 2013 IBM Corp.
* Copyright (c) 2012, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -24,7 +24,7 @@
#include <ctype.h>
#include "MQTTAsync.h"
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#include <windows.h>
#include <tchar.h>
#include <io.h>
......@@ -123,7 +123,7 @@ int loadandcall(char* libname)
{
int rc = 0;
MQTTAsync_nameValue* (*func_address)(void) = NULL;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
HMODULE APILibrary = LoadLibrary(libname);
if (APILibrary == NULL)
......@@ -187,7 +187,7 @@ int main(int argc, char** argv)
for (i = 0; i < ARRAY_SIZE(libraries); ++i)
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
sprintf(namebuf, "%s.dll", libraries[i]);
#else
sprintf(namebuf, "lib%s.so.1", libraries[i]);
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -44,7 +44,7 @@ void SSLSocket_addPendingRead(int sock);
static ssl_mutex_type* sslLocks = NULL;
static ssl_mutex_type sslCoreMutex;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define iov_len len
#define iov_base buf
#endif
......@@ -305,7 +305,7 @@ int SSL_create_mutex(ssl_mutex_type* mutex)
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
*mutex = CreateMutex(NULL, 0, NULL);
#else
rc = pthread_mutex_init(mutex, NULL);
......@@ -319,7 +319,7 @@ int SSL_lock_mutex(ssl_mutex_type* mutex)
int rc = -1;
/* don't add entry/exit trace points, as trace gets lock too, and it might happen quite frequently */
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
if (WaitForSingleObject(*mutex, INFINITE) != WAIT_FAILED)
#else
if ((rc = pthread_mutex_lock(mutex)) == 0)
......@@ -334,7 +334,7 @@ int SSL_unlock_mutex(ssl_mutex_type* mutex)
int rc = -1;
/* don't add entry/exit trace points, as trace gets lock too, and it might happen quite frequently */
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
if (ReleaseMutex(*mutex) != 0)
#else
if ((rc = pthread_mutex_unlock(mutex)) == 0)
......@@ -349,7 +349,7 @@ void SSL_destroy_mutex(ssl_mutex_type* mutex)
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
rc = CloseHandle(*mutex);
#else
rc = pthread_mutex_destroy(mutex);
......@@ -363,7 +363,7 @@ void SSL_destroy_mutex(ssl_mutex_type* mutex)
#if (OPENSSL_VERSION_NUMBER >= 0x010000000)
extern void SSLThread_id(CRYPTO_THREADID *id)
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId());
#else
CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self());
......@@ -372,7 +372,7 @@ extern void SSLThread_id(CRYPTO_THREADID *id)
#else
extern unsigned long SSLThread_id(void)
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
return (unsigned long)GetCurrentThreadId();
#else
return (unsigned long)pthread_self();
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -16,7 +16,7 @@
#if !defined(SSLSOCKET_H)
#define SSLSOCKET_H
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define ssl_mutex_type HANDLE
#else
#include <pthread.h>
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -42,7 +42,7 @@
int Socket_close_only(int socket);
int Socket_continueWrites(fd_set* pwset);
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define iov_len len
#define iov_base buf
#endif
......@@ -61,7 +61,7 @@ static fd_set wset;
int Socket_setnonblocking(int sock)
{
int rc;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
u_long flag = 1L;
FUNC_ENTRY;
......@@ -87,12 +87,12 @@ int Socket_setnonblocking(int sock)
*/
int Socket_error(char* aString, int sock)
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
int errno;
#endif
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
errno = WSAGetLastError();
#endif
if (errno != EINTR && errno != EAGAIN && errno != EINPROGRESS && errno != EWOULDBLOCK)
......@@ -110,7 +110,7 @@ int Socket_error(char* aString, int sock)
*/
void Socket_outInitialize()
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
WORD winsockVer = 0x0202;
WSADATA wsd;
......@@ -144,7 +144,7 @@ void Socket_outTerminate()
ListFree(s.write_pending);
ListFree(s.clientsds);
SocketBuffer_terminate();
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
WSACleanup();
#endif
FUNC_EXIT;
......@@ -397,7 +397,7 @@ int Socket_writev(int socket, iobuf* iovecs, int count, unsigned long* bytes)
int rc;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
rc = WSASend(socket, iovecs, count, (LPDWORD)bytes, 0, NULL, NULL);
if (rc == SOCKET_ERROR)
{
......@@ -517,7 +517,7 @@ int Socket_close_only(int socket)
int rc;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
if (shutdown(socket, SD_BOTH) == SOCKET_ERROR)
Socket_error("shutdown", socket);
if ((rc = closesocket(socket)) == SOCKET_ERROR)
......@@ -587,7 +587,7 @@ int Socket_new(char* addr, int port, int* sock)
struct sockaddr_in6 address6;
#endif
int rc = SOCKET_ERROR;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
short family;
#else
sa_family_t family = AF_INET;
......@@ -812,7 +812,7 @@ char* Socket_getaddrname(struct sockaddr* sa, int sock)
#define PORTLEN 10
static char addr_string[ADDRLEN + PORTLEN];
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
int buflen = ADDRLEN*2;
wchar_t buf[ADDRLEN*2];
if (WSAAddressToString(sa, sizeof(struct sockaddr_in6), NULL, buf, (LPDWORD)&buflen) == SOCKET_ERROR)
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -20,7 +20,7 @@
#include <sys/types.h>
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#include <winsock2.h>
#include <ws2tcpip.h>
#define MAXHOSTNAMELEN 256
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -33,7 +33,7 @@
#include "Heap.h"
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define iov_len len
#define iov_base buf
#endif
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -18,7 +18,7 @@
#if !defined(SOCKETBUFFER_H)
#define SOCKETBUFFER_H
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#include "winsock2.h"
#else
#include <sys/socket.h>
......@@ -28,7 +28,7 @@
#include <openssl/ssl.h>
#endif
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
typedef WSABUF iobuf;
#else
typedef struct iovec iobuf;
......
/*******************************************************************************
* Copyright (c) 2009, 2012 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -25,7 +25,7 @@
#include <string.h>
#include <stdlib.h>
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define snprintf _snprintf
#endif
......@@ -64,7 +64,7 @@ static int thread_count = 0;
static threadEntry threads[MAX_THREADS];
static threadEntry *cur_thread = NULL;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
mutex_type stack_mutex;
#else
static pthread_mutex_t stack_mutex_store = PTHREAD_MUTEX_INITIALIZER;
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -33,7 +33,7 @@
#define FUNC_EXIT_MED_RC(x)
#define FUNC_EXIT_MAX_RC(x)
#else
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#define inline __inline
#define FUNC_ENTRY StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MINIMUM)
#define FUNC_ENTRY_NOLOG StackTrace_entry(__FUNCTION__, __LINE__, -1)
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -35,7 +35,7 @@
#undef realloc
#undef free
#if !defined(WIN32)
#if !defined(WIN32) && !defined(WIN64)
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
......@@ -55,7 +55,7 @@
*/
thread_type Thread_start(thread_fn fn, void* parameter)
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
thread_type thread = NULL;
#else
thread_type thread = 0;
......@@ -63,7 +63,7 @@ thread_type Thread_start(thread_fn fn, void* parameter)
#endif
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
thread = CreateThread(NULL, 0, fn, parameter, 0, NULL);
#else
pthread_attr_init(&attr);
......@@ -87,7 +87,7 @@ mutex_type Thread_create_mutex()
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
mutex = CreateMutex(NULL, 0, NULL);
#else
mutex = malloc(sizeof(pthread_mutex_t));
......@@ -108,7 +108,7 @@ int Thread_lock_mutex(mutex_type mutex)
int rc = -1;
/* don't add entry/exit trace points as the stack log uses mutexes - recursion beckons */
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
/* WaitForSingleObject returns WAIT_OBJECT_0 (0), on success */
rc = WaitForSingleObject(mutex, INFINITE);
#else
......@@ -129,7 +129,7 @@ int Thread_unlock_mutex(mutex_type mutex)
int rc = -1;
/* don't add entry/exit trace points as the stack log uses mutexes - recursion beckons */
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
/* if ReleaseMutex fails, the return value is 0 */
if (ReleaseMutex(mutex) == 0)
rc = GetLastError();
......@@ -152,7 +152,7 @@ void Thread_destroy_mutex(mutex_type mutex)
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
rc = CloseHandle(mutex);
#else
rc = pthread_mutex_destroy(mutex);
......@@ -168,7 +168,7 @@ void Thread_destroy_mutex(mutex_type mutex)
*/
thread_id_type Thread_getid()
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
return GetCurrentThreadId();
#else
return pthread_self();
......@@ -200,7 +200,7 @@ sem_type Thread_create_sem()
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
sem = CreateEvent(
NULL, // default security attributes
FALSE, // manual-reset event?
......@@ -249,7 +249,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
* so I've used trywait in a loop instead. Ian Craggs 23/7/2010
*/
int rc = -1;
#if !defined(WIN32)
#if !defined(WIN32) && !defined(WIN64)
#define USE_TRYWAIT
#if defined(USE_TRYWAIT)
int i = 0;
......@@ -261,7 +261,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
#endif
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
rc = WaitForSingleObject(sem, timeout);
#elif defined(USE_TRYWAIT)
while (++i < count && (rc = sem_trywait(sem)) != 0)
......@@ -293,7 +293,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
*/
int Thread_check_sem(sem_type sem)
{
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
return WaitForSingleObject(sem, 0) == WAIT_OBJECT_0;
#else
int semval = -1;
......@@ -313,7 +313,7 @@ int Thread_post_sem(sem_type sem)
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
if (SetEvent(sem) == 0)
rc = GetLastError();
#else
......@@ -335,7 +335,7 @@ int Thread_destroy_sem(sem_type sem)
int rc = 0;
FUNC_ENTRY;
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
rc = CloseHandle(sem);
#elif defined(USE_NAMED_SEMAPHORES)
int i;
......@@ -359,7 +359,7 @@ int Thread_destroy_sem(sem_type sem)
}
#if !defined(WIN32)
#if !defined(WIN32) && !defined(WIN64)
/**
* Create a new condition variable
* @return the condition variable struct
......
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corp.
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -19,7 +19,7 @@
#if !defined(THREAD_H)
#define THREAD_H
#if defined(WIN32)
#if defined(WIN32) || defined(WIN64)
#include <Windows.h>
#define thread_type HANDLE
#define thread_id_type DWORD
......
......@@ -240,7 +240,7 @@ void myassert(char* filename, int lineno, char* description, int value, char* fo
va_list args;
++failures;
printf("Assertion failed, file %s, line %d, description: %s\n", filename, lineno, description);
MyLog(LOGA_INFO, "Assertion failed, file %s, line %d, description: %s\n", filename, lineno, description);
va_start(args, format);
vprintf(format, args);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment