mirror of https://github.com/eclipse/paho.mqtt.c
Move definition of mutex_type into own header file
To avoid inconsitstant definition of "bool", the definition of mutex_type is moved into its own header file. This way, Socket.h does not need to include Thread.h. Signed-off-by: Juergen Kosel <juergen.kosel@softing.com>
This commit is contained in:
parent
e858851455
commit
231eda090d
|
|
@ -65,7 +65,7 @@
|
|||
#define ULONG size_t
|
||||
#endif
|
||||
|
||||
#include "Thread.h" /* Needed for mutex_type */
|
||||
#include "mutex_type.h" /* Needed for mutex_type */
|
||||
|
||||
/** socket operation completed successfully */
|
||||
#define TCPSOCKET_COMPLETE 0
|
||||
|
|
@ -126,7 +126,7 @@ typedef struct
|
|||
|
||||
void Socket_outInitialize(void);
|
||||
void Socket_outTerminate(void);
|
||||
int Socket_getReadySocket(int more_work, struct timeval *tp,mutex_type mutex);
|
||||
int Socket_getReadySocket(int more_work, struct timeval *tp, mutex_type mutex);
|
||||
int Socket_getch(int socket, char* c);
|
||||
char *Socket_getdata(int socket, size_t bytes, size_t* actual_len);
|
||||
int Socket_putdatas(int socket, char* buf0, size_t buf0len, int count, char** buffers, size_t* buflens, int* frees);
|
||||
|
|
|
|||
|
|
@ -21,13 +21,14 @@
|
|||
#if !defined(THREAD_H)
|
||||
#define THREAD_H
|
||||
|
||||
#include "mutex_type.h" /* Needed for mutex_type */
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#include <windows.h>
|
||||
#define thread_type HANDLE
|
||||
#define thread_id_type DWORD
|
||||
#define thread_return_type DWORD
|
||||
#define thread_fn LPTHREAD_START_ROUTINE
|
||||
#define mutex_type HANDLE
|
||||
#define cond_type HANDLE
|
||||
#define sem_type HANDLE
|
||||
#else
|
||||
|
|
@ -37,7 +38,6 @@
|
|||
#define thread_id_type pthread_t
|
||||
#define thread_return_type void*
|
||||
typedef thread_return_type (*thread_fn)(void*);
|
||||
#define mutex_type pthread_mutex_t*
|
||||
typedef struct { pthread_cond_t cond; pthread_mutex_t mutex; } cond_type_struct;
|
||||
typedef cond_type_struct *cond_type;
|
||||
#if defined(OSX)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
/*******************************************************************************
|
||||
* 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
|
||||
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#ifndef _MUTEX_TYPE_H_
|
||||
#define _MUTEX_TYPE_H_
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#include <windows.h>
|
||||
#define mutex_type HANDLE
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#define mutex_type pthread_mutex_t*
|
||||
#endif
|
||||
|
||||
#endif /* _MUTEX_TYPE_H_ */
|
||||
Loading…
Reference in New Issue