os: fix Mac Semaphore error
This commit is contained in:
parent
679145dcb6
commit
70ea1235df
|
@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE OFF)
|
set(CMAKE_VERBOSE_MAKEFILE OFF)
|
||||||
|
|
||||||
SET(BUILD_SHARED_LIBS "OFF")
|
|
||||||
|
|
||||||
#set output directory
|
#set output directory
|
||||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib)
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib)
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
SET(PREPARE_ENV_CMD "prepare_env_cmd")
|
||||||
|
SET(PREPARE_ENV_TARGET "prepare_env_target")
|
||||||
|
ADD_CUSTOM_COMMAND(OUTPUT ${PREPARE_ENV_CMD}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND echo "make test directory"
|
||||||
|
DEPENDS taosd
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/cfg/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/log/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/data/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo dataDir ${TD_TESTS_OUTPUT_DIR}/data > ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo logDir ${TD_TESTS_OUTPUT_DIR}/log >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo charset UTF-8 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo monitor 0 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||||
|
COMMENT "prepare taosd environment")
|
||||||
|
ADD_CUSTOM_TARGET(${PREPARE_ENV_TARGET} ALL WORKING_DIRECTORY ${TD_EXECUTABLE_OUTPUT_PATH} DEPENDS ${PREPARE_ENV_CMD})
|
||||||
|
|
||||||
IF (TD_LINUX)
|
IF (TD_LINUX)
|
||||||
SET(TD_MAKE_INSTALL_SH "${TD_SOURCE_DIR}/packaging/tools/make_install.sh")
|
SET(TD_MAKE_INSTALL_SH "${TD_SOURCE_DIR}/packaging/tools/make_install.sh")
|
||||||
INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")")
|
INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")")
|
||||||
|
|
|
@ -90,6 +90,12 @@ ELSE ()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
option(
|
||||||
|
BUILD_SHARED_LIBS
|
||||||
|
""
|
||||||
|
OFF
|
||||||
|
)
|
||||||
|
|
||||||
option(
|
option(
|
||||||
RUST_BINDINGS
|
RUST_BINDINGS
|
||||||
"If build with rust-bindings"
|
"If build with rust-bindings"
|
||||||
|
|
|
@ -1,75 +1,74 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TD_OS_SEMPHONE_H_
|
#ifndef _TD_OS_SEMPHONE_H_
|
||||||
#define _TD_OS_SEMPHONE_H_
|
#define _TD_OS_SEMPHONE_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
#if defined(_TD_DARWIN_64)
|
#if defined(_TD_DARWIN_64)
|
||||||
|
#include <dispatch/dispatch.h>
|
||||||
// typedef struct tsem_s *tsem_t;
|
// typedef struct tsem_s *tsem_t;
|
||||||
typedef struct bosal_sem_t *tsem_t;
|
typedef dispatch_semaphore_t tsem_t;
|
||||||
|
|
||||||
|
int tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
||||||
int tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
int tsem_wait(tsem_t *sem);
|
||||||
int tsem_wait(tsem_t *sem);
|
int tsem_timewait(tsem_t *sim, int64_t nanosecs);
|
||||||
int tsem_timewait(tsem_t *sim, int64_t nanosecs);
|
int tsem_post(tsem_t *sem);
|
||||||
int tsem_post(tsem_t *sem);
|
int tsem_destroy(tsem_t *sem);
|
||||||
int tsem_destroy(tsem_t *sem);
|
|
||||||
|
#else
|
||||||
#else
|
|
||||||
|
#define tsem_t sem_t
|
||||||
#define tsem_t sem_t
|
#define tsem_init sem_init
|
||||||
#define tsem_init sem_init
|
int tsem_wait(tsem_t *sem);
|
||||||
int tsem_wait(tsem_t *sem);
|
int tsem_timewait(tsem_t *sim, int64_t nanosecs);
|
||||||
int tsem_timewait(tsem_t *sim, int64_t nanosecs);
|
#define tsem_post sem_post
|
||||||
#define tsem_post sem_post
|
#define tsem_destroy sem_destroy
|
||||||
#define tsem_destroy sem_destroy
|
|
||||||
|
#endif
|
||||||
#endif
|
|
||||||
|
#if defined(_TD_DARWIN_64)
|
||||||
#if defined(_TD_DARWIN_64)
|
// #define TdThreadRwlock TdThreadMutex
|
||||||
// #define TdThreadRwlock TdThreadMutex
|
// #define taosThreadRwlockInit(lock, NULL) taosThreadMutexInit(lock, NULL)
|
||||||
// #define taosThreadRwlockInit(lock, NULL) taosThreadMutexInit(lock, NULL)
|
// #define taosThreadRwlockDestroy(lock) taosThreadMutexDestroy(lock)
|
||||||
// #define taosThreadRwlockDestroy(lock) taosThreadMutexDestroy(lock)
|
// #define taosThreadRwlockWrlock(lock) taosThreadMutexLock(lock)
|
||||||
// #define taosThreadRwlockWrlock(lock) taosThreadMutexLock(lock)
|
// #define taosThreadRwlockRdlock(lock) taosThreadMutexLock(lock)
|
||||||
// #define taosThreadRwlockRdlock(lock) taosThreadMutexLock(lock)
|
// #define taosThreadRwlockUnlock(lock) taosThreadMutexUnlock(lock)
|
||||||
// #define taosThreadRwlockUnlock(lock) taosThreadMutexUnlock(lock)
|
|
||||||
|
// #define TdThreadSpinlock TdThreadMutex
|
||||||
// #define TdThreadSpinlock TdThreadMutex
|
// #define taosThreadSpinInit(lock, NULL) taosThreadMutexInit(lock, NULL)
|
||||||
// #define taosThreadSpinInit(lock, NULL) taosThreadMutexInit(lock, NULL)
|
// #define taosThreadSpinDestroy(lock) taosThreadMutexDestroy(lock)
|
||||||
// #define taosThreadSpinDestroy(lock) taosThreadMutexDestroy(lock)
|
// #define taosThreadSpinLock(lock) taosThreadMutexLock(lock)
|
||||||
// #define taosThreadSpinLock(lock) taosThreadMutexLock(lock)
|
// #define taosThreadSpinUnlock(lock) taosThreadMutexUnlock(lock)
|
||||||
// #define taosThreadSpinUnlock(lock) taosThreadMutexUnlock(lock)
|
#endif
|
||||||
#endif
|
|
||||||
|
bool taosCheckPthreadValid(TdThread thread);
|
||||||
bool taosCheckPthreadValid(TdThread thread);
|
int64_t taosGetSelfPthreadId();
|
||||||
int64_t taosGetSelfPthreadId();
|
int64_t taosGetPthreadId(TdThread thread);
|
||||||
int64_t taosGetPthreadId(TdThread thread);
|
void taosResetPthread(TdThread *thread);
|
||||||
void taosResetPthread(TdThread *thread);
|
bool taosComparePthread(TdThread first, TdThread second);
|
||||||
bool taosComparePthread(TdThread first, TdThread second);
|
int32_t taosGetPId();
|
||||||
int32_t taosGetPId();
|
int32_t taosGetAppName(char *name, int32_t *len);
|
||||||
int32_t taosGetAppName(char *name, int32_t *len);
|
|
||||||
|
#ifdef __cplusplus
|
||||||
#ifdef __cplusplus
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
#endif /*_TD_OS_SEMPHONE_H_*/
|
||||||
#endif /*_TD_OS_SEMPHONE_H_*/
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue