build: check -tags nogc

This commit is contained in:
visualfc
2024-08-16 09:06:28 +08:00
parent b42ad3170e
commit d6d0faac6e
8 changed files with 60 additions and 43 deletions

View File

@@ -1,11 +0,0 @@
#define GC_THREADS
#include <gc.h>
#include <pthread.h>
int llgoPthreadCreate(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) {
return GC_pthread_create(thread, attr, start_routine, arg);
}
int llgoPthreadJoin(pthread_t thread, void **retval) {
return GC_pthread_join(thread, retval);
}

View File

@@ -32,6 +32,9 @@ type aThread struct {
Unused [8]byte
}
//llgo:type C
type RoutineFunc func(c.Pointer) c.Pointer
// Thread represents a POSIX thread.
type Thread = *aThread

View File

@@ -26,7 +26,6 @@ import (
)
const (
LLGoFiles = "$(pkg-config --cflags bdw-gc): _wrap/pthread_gc.c"
LLGoPackage = "link: $(pkg-config --libs bdw-gc); -lgc"
)
@@ -56,8 +55,8 @@ const (
//
// See https://man7.org/linux/man-pages/man3/pthread_create.3.html
//
//go:linkname Create C.llgoPthreadCreate
func Create(pthread *Thread, attr *Attr, routine func(c.Pointer) c.Pointer, arg c.Pointer) c.Int
//go:linkname Create C.GC_pthread_create
func Create(pthread *Thread, attr *Attr, routine RoutineFunc, arg c.Pointer) c.Int
// The pthread_join() function waits for the thread specified by
// thread to terminate. If that thread has already terminated, then
@@ -77,5 +76,5 @@ func Create(pthread *Thread, attr *Attr, routine func(c.Pointer) c.Pointer, arg
//
// See https://man7.org/linux/man-pages/man3/pthread_join.3.html
//
//go:linkname Join C.llgoPthreadJoin
//go:linkname Join C.GC_pthread_join
func Join(thread Thread, retval *c.Pointer) c.Int

View File

@@ -56,7 +56,7 @@ const (
// See https://man7.org/linux/man-pages/man3/pthread_create.3.html
//
//go:linkname Create C.pthread_create
func Create(pthread *Thread, attr *Attr, routine func(c.Pointer) c.Pointer, arg c.Pointer) c.Int
func Create(pthread *Thread, attr *Attr, routine RoutineFunc, arg c.Pointer) c.Int
// The pthread_join() function waits for the thread specified by
// thread to terminate. If that thread has already terminated, then