Index: mozilla/nsprpub/pr/include/pratom.h =================================================================== RCS file: /cvsroot/mozilla/nsprpub/pr/include/pratom.h,v retrieving revision 3.8 diff -U30 -r3.8 mozilla/nsprpub/pr/include/pratom.h --- mozilla/nsprpub/pr/include/pratom.h +++ mozilla/nsprpub/pr/include/pratom.h @@ -21,60 +21,79 @@ * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* GLOBAL FUNCTIONS: ** DESCRIPTION: ** PR Atomic operations */ #ifndef pratom_h___ #define pratom_h___ #include "prtypes.h" #include "prlock.h" PR_BEGIN_EXTERN_C +#if defined(_WIN32) && defined(_M_IX86) && (_MSC_VER >= 1310) && defined(_MT) +#define NSPR_USE_INTRINSIC_LOCKS +#else +#undef NSPR_USE_INTRINSIC_LOCKS + +#ifdef NSPR_USE_INTRINSIC_LOCKS +long __cdecl _InterlockedIncrement(PRInt32 volatile *Addend); +#pragma intrinsic(_InterlockedIncrement) + +long __cdecl _InterlockedDecrement(PRInt32 volatile *Addend); +#pragma intrinsic(_InterlockedDecrement) + +#define PR_ATOMICINCREMENT(val) _InterlockedIncrement(val) +#define PR_ATOMICDECREMENT(val) _InterlockedDecrement(val) +#else +#define PR_ATOMICINCREMENT(val) PR_AtomicIncrement(val) +#define PR_ATOMICDECREMENT(val) PR_AtomicDecrement(val) +#endif + /* ** FUNCTION: PR_AtomicIncrement ** DESCRIPTION: ** Atomically increment a 32 bit value. ** INPUTS: ** val: a pointer to the value to increment ** RETURN: ** the returned value is the result of the increment */ NSPR_API(PRInt32) PR_AtomicIncrement(PRInt32 *val); /* ** FUNCTION: PR_AtomicDecrement ** DESCRIPTION: ** Atomically decrement a 32 bit value. ** INPUTS: ** val: a pointer to the value to decrement ** RETURN: ** the returned value is the result of the decrement */ NSPR_API(PRInt32) PR_AtomicDecrement(PRInt32 *val); /* ** FUNCTION: PR_AtomicSet ** DESCRIPTION: ** Atomically set a 32 bit value. ** INPUTS: ** val: A pointer to a 32 bit value to be set ** newval: The newvalue to assign to val ** RETURN: Index: mozilla/nsprpub/pr/src/misc/pratom.c =================================================================== RCS file: /cvsroot/mozilla/nsprpub/pr/src/misc/pratom.c,v retrieving revision 3.19 diff -U30 -r3.19 mozilla/nsprpub/pr/src/misc/pratom.c Index: mozilla/security/nss/lib/ckfw/nsprstub.c =================================================================== RCS file: /cvsroot/mozilla/security/nss/lib/ckfw/nsprstub.c,v retrieving revision 1.6 diff -U30 -r1.6 mozilla/security/nss/lib/ckfw/nsprstub.c