pthread

package
v0.9.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LLGoPackage = "link: $(pkg-config --libs bdw-gc); -lgc"
)

Variables

This section is empty.

Functions

func Cancel

func Cancel(thread Thread) c.Int

The pthread_cancel() function sends a cancelation request to the thread thread.

See https://man7.org/linux/man-pages/man3/pthread_cancel.3.html

func Create

func Create(pthread *Thread, attr *Attr, routine RoutineFunc, arg c.Pointer) c.Int

The pthread_create() function starts a new thread in the calling process. The new thread starts execution by invoking start_routine(); arg is passed as the sole argument of start_routine().

The new thread terminates in one of the following ways:

  • It calls pthread_exit(3), specifying an exit status value that is available to another thread in the same process that calls pthread_join(3).

  • It returns from start_routine(). This is equivalent to calling pthread_exit(3) with the value supplied in the return statement.

  • It is canceled (see pthread_cancel(3)).

  • Any of the threads in the process calls exit(3), or the main thread performs a return from main(). This causes the termination of all threads in the process.

On success, pthread_create() returns 0; on error, it returns an error number, and the contents of *thread are undefined.

See https://man7.org/linux/man-pages/man3/pthread_create.3.html

func Exit

func Exit(retval c.Pointer)

The pthread_exit() function terminates the calling thread and returns a value via retval that (if the thread is joinable) is available to another thread in the same process that calls pthread_join(3).

See https://man7.org/linux/man-pages/man3/pthread_exit.3.html

func Join

func Join(thread Thread, retval *c.Pointer) c.Int

The pthread_join() function waits for the thread specified by thread to terminate. If that thread has already terminated, then pthread_join() returns immediately. The thread specified by thread must be joinable.

If retval is not NULL, then pthread_join() copies the exit status of the target thread (i.e., the value that the target thread supplied to pthread_exit(3)) into the location pointed to by retval. If the target thread was canceled, then PTHREAD_CANCELED is placed in the location pointed to by retval.

If multiple threads simultaneously try to join with the same thread, the results are undefined. If the thread calling pthread_join() is canceled, then the target thread will remain joinable (i.e., it will not be detached).

See https://man7.org/linux/man-pages/man3/pthread_join.3.html

Types

type Attr

type Attr struct {
	Detached byte
	SsSp     *c.Char
	SsSize   uintptr
}

Attr represents a POSIX thread attributes.

func (*Attr) Destroy

func (attr *Attr) Destroy() c.Int

llgo:link (*Attr).Destroy C.pthread_attr_destroy

func (*Attr) GetDetached

func (attr *Attr) GetDetached(detached *c.Int) c.Int

llgo:link (*Attr).GetDetached C.pthread_attr_getdetachstate

func (*Attr) GetStackAddr

func (attr *Attr) GetStackAddr(stackAddr *c.Pointer) c.Int

llgo:link (*Attr).GetStackAddr C.pthread_attr_getstackaddr

func (*Attr) GetStackSize

func (attr *Attr) GetStackSize(stackSize *uintptr) c.Int

llgo:link (*Attr).GetStackSize C.pthread_attr_getstacksize

func (*Attr) Init

func (attr *Attr) Init() c.Int

llgo:link (*Attr).Init C.pthread_attr_init

func (*Attr) SetDetached

func (attr *Attr) SetDetached(detached c.Int) c.Int

llgo:link (*Attr).SetDetached C.pthread_attr_setdetachstate

func (*Attr) SetStackAddr

func (attr *Attr) SetStackAddr(stackAddr c.Pointer) c.Int

llgo:link (*Attr).SetStackAddr C.pthread_attr_setstackaddr

func (*Attr) SetStackSize

func (attr *Attr) SetStackSize(stackSize uintptr) c.Int

llgo:link (*Attr).SetStackSize C.pthread_attr_setstacksize

type Key

type Key c.Uint

func (*Key) Create

func (key *Key) Create(destructor func(c.Pointer)) c.Int

llgo:link (*Key).Create C.pthread_key_create

func (Key) Delete

func (key Key) Delete() c.Int

llgo:link Key.Delete C.pthread_key_delete

func (Key) Get

func (key Key) Get() c.Pointer

llgo:link Key.Get C.pthread_getspecific

func (Key) Set

func (key Key) Set(value c.Pointer) c.Int

llgo:link Key.Set C.pthread_setspecific

type RoutineFunc added in v0.9.7

type RoutineFunc func(c.Pointer) c.Pointer

type Thread

type Thread = *aThread

Thread represents a POSIX thread.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL