DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9504

pthread_mutex_lock is slow on solaris

           Summary: pthread_mutex_lock is slow on solaris
           Product: Xerces-C++
           Version: 1.7.0
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Utilities
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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;
}

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

Reply via email to