Files
asterisk/include/asterisk
George Joseph 64045f0b57 This patch adds support for spinlocks in Asterisk.
There are cases in Asterisk where it might be desirable to lock
a short critical code section but not incur the context switch
and yield penalty of a mutex or rwlock.  The primary spinlock
implementations execute exclusively in userspace and therefore
don't incur those penalties.  Spinlocks are NOT meant to be a
general replacement for mutexes.  They should be used only for
protecting short blocks of critical code such as simple compares
and assignments.  Operations that may block, hold a lock, or
cause the thread to give up it's timeslice should NEVER be
attempted in a spinlock.

The first use case for spinlocks is in astobj2 - internal_ao2_ref.
Currently the manipulation of the reference counter is done with
an ast_atomic_fetchadd_int which works fine.  When weak reference
containers are introduced however, there's an additional comparison
and assignment that'll need to be done while the lock is held.
A mutex would be way too expensive here, hence the spinlock.
Given that lock contention in this situation would be infrequent,
the overhead of the spinlock is only a few more machine instructions
than the current ast_atomic_fetchadd_int call.

ASTERISK-23553 #close
Review: https://reviewboard.asterisk.org/r/3405/
........

Merged revisions 412976 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-23 20:13:30 +00:00
..
2013-10-04 16:01:48 +00:00
2012-06-25 15:55:25 +00:00
2014-04-17 21:57:36 +00:00
2014-01-12 22:24:27 +00:00
2013-11-27 17:32:29 +00:00
2013-07-19 23:30:10 +00:00
2013-07-25 04:06:32 +00:00
2013-08-22 18:52:41 +00:00
2013-09-27 14:08:23 +00:00
2013-08-25 18:00:46 +00:00
2012-08-30 14:23:28 +00:00
2012-08-30 14:23:28 +00:00
2013-10-04 16:01:48 +00:00
2013-07-03 17:58:45 +00:00
2014-01-17 21:33:26 +00:00
2014-03-15 15:24:23 +00:00
2012-08-30 14:23:28 +00:00
2012-09-21 17:14:59 +00:00
2013-11-02 04:12:36 +00:00
2012-08-30 14:23:28 +00:00
2013-05-14 21:45:08 +00:00
2013-08-30 20:58:59 +00:00
2013-08-17 15:01:54 +00:00
2013-07-03 17:58:45 +00:00
2014-01-06 17:45:25 +00:00
2012-09-21 17:14:59 +00:00
2012-02-24 15:10:35 +00:00
2011-10-11 19:06:29 +00:00
2012-10-18 14:17:40 +00:00
2013-04-22 16:22:00 +00:00
2013-05-08 13:39:08 +00:00
2013-11-23 17:26:57 +00:00
2013-02-14 18:47:56 +00:00
2012-08-30 14:23:28 +00:00
2013-11-23 17:26:57 +00:00
2013-02-15 13:38:12 +00:00
2013-02-15 13:38:12 +00:00