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
Initialize a thread spinlock
#include <pthread.h>
int pthread_spin_init( pthread_spinlock_t * spinner,
int pshared );
- 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:
- PTHREAD_PROCESS_SHARED — the spinlock may be
operated on by any thread that has access to the memory where the
spinlock is allocated, even if it's allocated in memory that's shared
by multiple processes.
- PTHREAD_PROCESS_PRIVATE — the spinlock can be
operated on only by threads created within the same process as the
thread that initialized the spinlock.
If threads of differing processes attempt to operate on such a spinlock,
the behavior is undefined.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
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.
Zero on success, or an error number to indicate the error.
- 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.
POSIX 1003.1 THR SPI
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
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