Fix compile errors on macOS and add some tests

This commit is contained in:
xl000
2023-05-21 20:24:25 +08:00
parent 3d6d57d199
commit af69301e52
9 changed files with 85 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
//go:build darwin
// +build darwin
package logger
/*
#include <pthread.h>
static unsigned long long thread_id() {
unsigned long long tid;
pthread_threadid_np(NULL, &tid);
return tid;
}
*/
import "C"
import "strconv"
func (l *Logger) getThreadId() (threadId string) {
return strconv.FormatUint(uint64(C.thread_id()), 10)
}

View File

@@ -1,5 +1,5 @@
//go:build !linux
// +build !linux
//go:build windows
// +build windows
package logger