You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org> on 2009/11/17 14:26:39 UTC
[jira] Closed: (XERCESC-481) pthread_mutex_lock is slow on solaris
[ https://issues.apache.org/jira/browse/XERCESC-481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Boris Kolpackov closed XERCESC-481.
-----------------------------------
Resolution: Invalid
Assignee: (was: Xerces-C Developers Mailing List)
I believe this has been addressed in Solaris.
> pthread_mutex_lock is slow on solaris
> -------------------------------------
>
> Key: XERCESC-481
> URL: https://issues.apache.org/jira/browse/XERCESC-481
> Project: Xerces-C++
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.7.0
> Environment: Operating System: Solaris
> Platform: Sun
> Reporter: Case Larsen
>
> Since this is used a lot in the string pool, it impacts performance. here is a fix which we use and it works.
> // this returns old value, so we need to add or subtract value to get true value
> inline int ink_atomic_increment(void *mem, int value)
> {
> volatile int * memp = (int *)mem;
> for (;;) {
> int current = *memp;
> int new_value = current+value;
> asm("cas %2,%3,%0" : "=r" (new_value) : "0" (new_value), "m" (*memp),
> "r" (current));
> if (new_value == current) return current;
> }
> }
> int XMLPlatformUtils::atomicIncrement(int &location)
> {
> return ink_atomic_increment(&location,1) + 1;
> }
> int XMLPlatformUtils::atomicDecrement(int &location)
> {
> return ink_atomic_increment(&location,-1) - 1;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org