C++程序  |  14行  |  245 B


#include "Common.h"

int wsAtomicAdd(int *var, int val)
{
    int cc;
    int ret;
    cc = pthread_mutex_lock(&gWrapSim.atomicLock);
    ret = *var;
    *var = *var + val;
    cc = pthread_mutex_unlock(&gWrapSim.atomicLock);
    return ret;
}