Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_spin_init.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_spin_init.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_spin_init.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_spin_init.html on line 8

pthread_spin_init()

Initialize a thread spinlock

Synopsis:

#include <pthread.h>

int pthread_spin_init( pthread_spinlock_t * spinner,
                       int pshared );

Arguments:

spinner
A pointer to the pthread_spinlock_t object that you want to initialize.
pshared
The value that you want to use for the process-shared attribute of the spinlock. The possible values are:

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_spin_init() function allocates the resources required for the thread spinlock spinner, and initializes spinner to an unlocked state.

Any thread that can access the memory where spinner is allocated can operate on the spinlock.

Results are undefined if you call pthread_spin_init() on a spinner that's already initialized, or if you try to use a spinlock that hasn't been initialized.

Returns:

Zero on success, or an error number to indicate the error.

Errors:

EAGAIN
The system doesn't have the resources required to initialize a new spinlock.
EBUSY
The process spinlock, spinner, is in use by another thread and can't be initialized.
EINVAL
Invalid pthread_spinlock_t object spinner.
ENOMEM
The system doesn't have enough free memory to create the new spinlock.

Classification:

POSIX 1003.1 THR SPI

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pthread_spin_destroy(), pthread_spin_lock(), pthread_spin_trylock(), pthread_spin_unlock()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_spin_init.html on line 173

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_spin_init.html on line 173