mirror of
https://github.com/goplus/llgo.git
synced 2025-09-27 03:56:05 +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>
32 lines
609 B
Go
32 lines
609 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"sync"
|
|
"unsafe"
|
|
|
|
llsync "github.com/goplus/lib/c/pthread/sync"
|
|
)
|
|
|
|
type L struct {
|
|
mu sync.Mutex
|
|
s string
|
|
i int
|
|
w io.Writer
|
|
}
|
|
|
|
func main() {
|
|
l := &L{s: "hello", i: 123, w: os.Stdout}
|
|
println("sizeof(L):", unsafe.Sizeof(L{}))
|
|
println("sizeof(sync.Mutex):", unsafe.Sizeof(sync.Mutex{}))
|
|
println("sizeof(llsync.Mutex):", unsafe.Sizeof(llsync.Mutex{}))
|
|
println("l:", l, "l.s:", l.s, "l.i:", l.i, "l.w:", l.w)
|
|
l.mu.Lock()
|
|
println("locked")
|
|
println("l:", l, "l.s:", l.s, "l.i:", l.i, "l.w:", l.w)
|
|
l.w.Write([]byte(l.s))
|
|
l.w.Write([]byte("\n"))
|
|
l.mu.Unlock()
|
|
}
|