| interlck.c (cdf0e10c) | interlck.c (1309f2c9) |
|---|---|
| 1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * --- 120 unchanged lines hidden (view full) --- 129 " isync" 130 : "=&r" (nCount), "=m" (*pCount) 131 : "r" (pCount) 132 : "memory"); 133 134 return nCount; 135} 136 | 1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * --- 120 unchanged lines hidden (view full) --- 129 " isync" 130 : "=&r" (nCount), "=m" (*pCount) 131 : "r" (pCount) 132 : "memory"); 133 134 return nCount; 135} 136 |
| 137#elif defined ( GCC ) && defined ( ARM ) 138 139/*****************************************************************************/ 140/* osl_incrementInterlockedCount */ 141/*****************************************************************************/ 142oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount) 143{ 144#if defined( ARMV7 ) || defined( ARMV6 ) 145 register oslInterlockedCount nCount __asm__ ("r1"); 146 int nResult; 147 148 __asm__ __volatile__ ( 149"1: ldrex %0, [%3]\n" 150" add %0, %0, #1\n" 151" strex %1, %0, [%3]\n" 152" teq %1, #0\n" 153" bne 1b" 154 : "=&r" (nCount), "=&r" (nResult), "=m" (*pCount) 155 : "r" (pCount) 156 : "memory"); 157 158 return nCount; |
|
| 137#else | 159#else |
| 160 return __sync_add_and_fetch( pCount, 1 ); 161#endif 162} 163 164oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount) 165{ 166#if defined( ARMV7 ) || defined( ARMV6 ) 167 register oslInterlockedCount nCount __asm__ ("r1"); 168 int nResult; 169 170 __asm__ __volatile__ ( 171"0: ldrex %0, [%3]\n" 172" sub %0, %0, #1\n" 173" strex %1, %0, [%3]\n" 174" teq %1, #0\n" 175" bne 0b" 176 : "=&r" (nCount), "=&r" (nResult), "=m" (*pCount) 177 : "r" (pCount) 178 : "memory"); 179 return nCount; 180#else 181 return __sync_sub_and_fetch( pCount, 1 ); 182#endif 183} 184 185#else |
|
| 138/* use only if nothing else works, expensive due to single mutex for all reference counts */ 139 140static pthread_mutex_t InterLock = PTHREAD_MUTEX_INITIALIZER; 141 142/*****************************************************************************/ 143/* osl_incrementInterlockedCount */ 144/*****************************************************************************/ 145oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount) --- 25 unchanged lines hidden --- | 186/* use only if nothing else works, expensive due to single mutex for all reference counts */ 187 188static pthread_mutex_t InterLock = PTHREAD_MUTEX_INITIALIZER; 189 190/*****************************************************************************/ 191/* osl_incrementInterlockedCount */ 192/*****************************************************************************/ 193oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount) --- 25 unchanged lines hidden --- |