mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 14:22:26 +08:00
Fix compile errors on macOS and add some tests
This commit is contained in:
20
pkg/logger/logger_darwin.go
Normal file
20
pkg/logger/logger_darwin.go
Normal 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)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package logger
|
||||
|
||||
|
||||
Reference in New Issue
Block a user