auto commit
This commit is contained in:
3
C/source/.gitignore
vendored
3
C/source/.gitignore
vendored
@@ -1,7 +1,7 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
build/*
|
||||
build
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
@@ -256,6 +256,7 @@ paket-files/
|
||||
*.sln.iml
|
||||
target/
|
||||
cmake-build-*
|
||||
source.code-*
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
@@ -8,17 +8,16 @@ set(CMAKE_C_STANDARD 11)
|
||||
aux_source_directory(. DIR_SRCS)
|
||||
add_subdirectory(idgen)
|
||||
|
||||
|
||||
#编译动态库
|
||||
#set(LIB_SRC YitIdHelper.h YitIdHelper.c)
|
||||
#add_library(YitIdGenLib SHARED ${LIB_SRC})
|
||||
#target_link_libraries(YitIdGenLib idgen)
|
||||
#set_target_properties(YitIdGenLib PROPERTIES
|
||||
# set(LIB_SRC YitIdHelper.h YitIdHelper.c)
|
||||
# add_library(YitIdGenLib SHARED ${LIB_SRC})
|
||||
# target_link_libraries(YitIdGenLib idgen)
|
||||
# set_target_properties(YitIdGenLib PROPERTIES
|
||||
# LINKER_LANGUAGE C
|
||||
# OUTPUT_NAME "yitidgenc"
|
||||
# PREFIX "")
|
||||
|
||||
##编译执行文件
|
||||
# 编译执行文件
|
||||
set(LIB_SRC YitIdHelper.h YitIdHelper.c)
|
||||
add_library(YitIdHelper ${LIB_SRC})
|
||||
add_executable(YitIdGen main.c)
|
||||
|
||||
@@ -109,7 +109,7 @@ extern void SetOptions(IdGeneratorOptions options) {
|
||||
_idGenerator->NextId = WorkerM2Id;
|
||||
} else {
|
||||
_idGenerator->NextId = WorkerM1Id;
|
||||
sleep(1);
|
||||
usleep(500*1000); // 暂停500ms
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ extern int64_t GetCurrentMicroTime() {
|
||||
extern int64_t GetNextTimeTick(SnowFlakeWorker *worker) {
|
||||
uint64_t tempTimeTicker = GetCurrentTimeTick(worker);
|
||||
while (tempTimeTicker <= worker->_LastTimeTick) {
|
||||
usleep(1000); // 暂停1ms
|
||||
tempTimeTicker = GetCurrentTimeTick(worker);
|
||||
}
|
||||
return tempTimeTicker;
|
||||
|
||||
Reference in New Issue
Block a user