Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ _spin_lock(3synch) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

_spin(3synch)

_spin_destroy(3synch)

_spin_init(3synch)

_spin_trylock(3synch)

_spin_unlock(3synch)

synch(3synch)






       _spin_lock(3synch)                                _spin_lock(3synch)


       NAME
             _spin_lock - lock a spin lock

       SYNOPSIS
             cc [options] -Kthread file
             #include <synch.h>
             void _spin_lock(spin_t *lock);

          Parameters
             lock   pointer to spin lock to be locked

       DESCRIPTION
             _spin_lock locks the spin lock pointed to by lock.  If lock is
             locked, the calling thread will busy-wait, or spin, until lock
             is available.  When _spin_lock returns, the caller has
             acquired lock.

             lock must previously have been initialized (see _spin_init).

          Return Values
             _spin_lock does not return a value.

          Errors
             None

       USAGE
             Because spin locks waste system resources, most applications
             should use mutexes instead of spin locks for mutual exclusion.
             In general, _spin_lock is used when the resources are held
             exclusively for such short durations that the expected spin is
             less costly than blocking and resuming the thread.

             Spin locks should only be used when there is a guarantee that
             the thread will not be preempted or blocked while holding a
             spin lock.

             The locks acquired with _spin_lock should be released with
             _spin_unlock.

          Warnings
             Spin locks must not be used on a uniprocessor.  In the best
             case, a spin lock on a uniprocessor will waste resources,
             slowing down the owner of the lock; in the worst case, it will
             deadlock the processor.




                           Copyright 1994 Novell, Inc.               Page 1













      _spin_lock(3synch)                                _spin_lock(3synch)


            Operations on spin locks are not recursive-a thread can
            deadlock if it attempts to relock a spin lock that it already
            has locked.

      REFERENCES
            _spin(3synch), _spin_destroy(3synch), _spin_init(3synch),
            _spin_trylock(3synch), _spin_unlock(3synch), synch(3synch)









































                          Copyright 1994 Novell, Inc.               Page 2








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026