mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-27 04:08:53 +01:00
d9acc57997
This change updates the copyright comment to respect the original GLFW source comments.
48 lines
982 B
Go
48 lines
982 B
Go
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-FileCopyrightText: 2002-2006 Marcus Geelnard
|
|
// SPDX-FileCopyrightText: 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
|
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
|
|
|
|
package goglfw
|
|
|
|
func (t *tls) create() error {
|
|
if t.platform.allocated {
|
|
panic("goglfw: TLS must not be allocated")
|
|
}
|
|
|
|
i, err := _TlsAlloc()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
t.platform.index = i
|
|
t.platform.allocated = true
|
|
return nil
|
|
}
|
|
|
|
func (t *tls) destroy() error {
|
|
if t.platform.allocated {
|
|
if err := _TlsFree(t.platform.index); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
t.platform.allocated = false
|
|
t.platform.index = 0
|
|
return nil
|
|
}
|
|
|
|
func (t *tls) get() (uintptr, error) {
|
|
if !t.platform.allocated {
|
|
panic("goglfw: TLS must be allocated")
|
|
}
|
|
|
|
return _TlsGetValue(t.platform.index)
|
|
}
|
|
|
|
func (t *tls) set(value uintptr) error {
|
|
if !t.platform.allocated {
|
|
panic("goglfw: TLS must be allocated")
|
|
}
|
|
|
|
return _TlsSetValue(t.platform.index, value)
|
|
}
|