[ http://nagoya.apache.org/jira/browse/XERCESC-481?page=history ]

Alberto Massari updated XERCESC-481:
------------------------------------

    Priority: Major

> pthread_mutex_lock is slow on solaris
> -------------------------------------
>
>          Key: XERCESC-481
>          URL: http://nagoya.apache.org/jira/browse/XERCESC-481
>      Project: Xerces-C++
>         Type: Bug
>   Components: Utilities
>     Versions: 1.7.0
>  Environment: Operating System: Solaris
> Platform: Sun
>     Reporter: Case Larsen
>     Assignee: Xerces-C Developers Mailing List

>
> 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.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to