gc: fix missing pthread registration causing unknown thread error

- Use `GC_pthread_create` instead of `pthread_create` when GC is
  enabled.
This commit is contained in:
Aofei Sheng
2024-08-15 18:40:17 +08:00
parent 4501519c4f
commit 8e66091dd2
7 changed files with 75 additions and 9 deletions

View File

@@ -22,10 +22,6 @@ import (
"github.com/goplus/llgo/c"
)
const (
LLGoPackage = "decl"
)
func __noop__() c.Int {
return 0
}
@@ -65,7 +61,7 @@ type Thread = *aThread
//
// See https://man7.org/linux/man-pages/man3/pthread_create.3.html
//
//go:linkname Create C.pthread_create
//go:linkname Create C.llgoPthreadCreate
func Create(pthread *Thread, attr *Attr, routine func(c.Pointer) c.Pointer, arg c.Pointer) c.Int
// The pthread_join() function waits for the thread specified by
@@ -86,7 +82,7 @@ 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.pthread_join
//go:linkname Join C.llgoPthreadJoin
func Join(thread Thread, retval *c.Pointer) c.Int
// The pthread_exit() function terminates the calling thread and