mirror of
https://github.com/goplus/llgo.git
synced 2025-09-26 19:51:21 +08:00

- Consolidate _demo, _pydemo, _embdemo into single _demo directory structure - Organize demos by language: _demo/{go,py,c,embed}/ - Categorize demos based on imports: - Python library demos (py imports) → _demo/py/ - C/C++ library demos (c/cpp imports) → _demo/c/ - Go-specific demos → _demo/go/ - Embedded demos → _demo/embed/ - Move C-related demos (asm*, cabi*, cgo*, linkname, targetsbuild) from go/ to c/ - Update all path references in README.md and GitHub workflows - Improve demo organization and navigation as requested in #1256 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
26 lines
524 B
Go
26 lines
524 B
Go
package main
|
|
|
|
import (
|
|
"github.com/goplus/lib/c"
|
|
"github.com/goplus/lib/c/pthread"
|
|
)
|
|
|
|
var key pthread.Key
|
|
|
|
func main() {
|
|
key.Create(nil)
|
|
key.Set(c.Pointer(c.Str("main value\n")))
|
|
|
|
var thd pthread.Thread
|
|
pthread.Create(&thd, nil, func(arg c.Pointer) c.Pointer {
|
|
key.Set(c.Pointer(c.Str("thread value\n")))
|
|
c.Printf(c.Str("Hello, thread\nTLS: %s"), key.Get())
|
|
return c.Pointer(c.Str("Back to main\n"))
|
|
}, nil)
|
|
|
|
var retval c.Pointer
|
|
pthread.Join(thd, &retval)
|
|
|
|
c.Printf(c.Str("%sTLS: %s"), retval, key.Get())
|
|
}
|