修复windows下vscode调试go程序名无后缀的情况导致程序crash (#6176)
* 修复windows下vscode调试go程序名无后缀的情况导致程序crash * 修复windows下vscode调试go程序时临时程序_debug_bin无后缀的情况,导致调用接口发生crash * 修复由于头文件排序导致编译错误
This commit is contained in:
parent
4729a13ed9
commit
105d6b040a
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "taosdef.h"
|
#include "taosdef.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
|
|
||||||
bool taosCheckPthreadValid(pthread_t thread) { return thread.p != NULL; }
|
bool taosCheckPthreadValid(pthread_t thread) { return thread.p != NULL; }
|
||||||
|
|
||||||
void taosResetPthread(pthread_t *thread) { thread->p = 0; }
|
void taosResetPthread(pthread_t* thread) { thread->p = 0; }
|
||||||
|
|
||||||
int64_t taosGetPthreadId(pthread_t thread) {
|
int64_t taosGetPthreadId(pthread_t thread) {
|
||||||
#ifdef PTW32_VERSION
|
#ifdef PTW32_VERSION
|
||||||
|
@ -34,27 +35,24 @@ int64_t taosGetPthreadId(pthread_t thread) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taosGetSelfPthreadId() {
|
int64_t taosGetSelfPthreadId() { return GetCurrentThreadId(); }
|
||||||
return GetCurrentThreadId();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool taosComparePthread(pthread_t first, pthread_t second) {
|
bool taosComparePthread(pthread_t first, pthread_t second) { return first.p == second.p; }
|
||||||
return first.p == second.p;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t taosGetPId() {
|
int32_t taosGetPId() { return GetCurrentProcessId(); }
|
||||||
return GetCurrentProcessId();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t taosGetCurrentAPPName(char *name, int32_t* len) {
|
int32_t taosGetCurrentAPPName(char* name, int32_t* len) {
|
||||||
char filepath[1024] = {0};
|
char filepath[1024] = {0};
|
||||||
|
|
||||||
GetModuleFileName(NULL, filepath, MAX_PATH);
|
GetModuleFileName(NULL, filepath, MAX_PATH);
|
||||||
*strrchr(filepath,'.') = '\0';
|
char* sub = strrchr(filepath, '.');
|
||||||
|
if (sub != NULL) {
|
||||||
|
*sub = '\0';
|
||||||
|
}
|
||||||
strcpy(name, filepath);
|
strcpy(name, filepath);
|
||||||
|
|
||||||
if (len != NULL) {
|
if (len != NULL) {
|
||||||
*len = (int32_t) strlen(filepath);
|
*len = (int32_t)strlen(filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue