diff options
| author | 2024-04-17 17:10:51 +0100 | |
|---|---|---|
| committer | 2024-04-17 17:10:51 +0100 | |
| commit | b3f2d441439af9d36096d11036220136588def43 (patch) | |
| tree | 87e7f8808fed70fa6b3d303bd139f03de67b8621 /vendor/modernc.org/libc/pthread.go | |
| parent | update to set requesting account when deleting status (#2849) (diff) | |
| download | gotosocial-b3f2d441439af9d36096d11036220136588def43.tar.xz | |
bump to modernc.org/sqlite v1.29.7 (#2850)
Diffstat (limited to 'vendor/modernc.org/libc/pthread.go')
| -rw-r--r-- | vendor/modernc.org/libc/pthread.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/modernc.org/libc/pthread.go b/vendor/modernc.org/libc/pthread.go index f47156a80..9e49cc0e4 100644 --- a/vendor/modernc.org/libc/pthread.go +++ b/vendor/modernc.org/libc/pthread.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !(linux && (amd64 || loong64)) + package libc // import "modernc.org/libc" import ( @@ -37,6 +39,7 @@ type TLS struct { errnop uintptr allocaStack [][]uintptr allocas []uintptr + jumpBuffers []uintptr pthreadData stack stackHeader @@ -82,6 +85,29 @@ func (t *TLS) FreeAlloca() func() { } } +func (tls *TLS) PushJumpBuffer(jb uintptr) { + tls.jumpBuffers = append(tls.jumpBuffers, jb) +} + +type LongjmpRetval int32 + +func (tls *TLS) PopJumpBuffer(jb uintptr) { + n := len(tls.jumpBuffers) + if n == 0 || tls.jumpBuffers[n-1] != jb { + panic(todo("unsupported setjmp/longjmp usage")) + } + + tls.jumpBuffers = tls.jumpBuffers[:n-1] +} + +func (tls *TLS) Longjmp(jb uintptr, val int32) { + tls.PopJumpBuffer(jb) + if val == 0 { + val = 1 + } + panic(LongjmpRetval(val)) +} + func Xalloca(tls *TLS, size size_t) uintptr { if __ccgo_strace { trc("tls=%v size=%v, (%v:)", tls, size, origin(2)) @@ -420,6 +446,7 @@ func (m *mutex) lock(id int32) int32 { m.Unlock() m.wait.Lock() + // intentional empty section - wake up other waiters m.wait.Unlock() } default: |
