_Atomic_swap

Sean McNeil sean@mcneil.com
Tue Apr 29 20:48:00 GMT 2003


Interestingly, this function is expected to be there in ropeimpl.h if
__GC is not defined.  Further, stl_threads.h will only define this
function if _GTHREAD_INIT is defined.  Under vxWorks,
_GTHREAD_INIT_FUNTION is defined, but not _GTHREAD_INIT.  I've had to
add the following to gcc/gthr-vxworks.h:

#ifdef __cplusplus
/* ropeimpl.h relies on having _Atomic_swap even though stl_threads.h
   only implements it if _GTHREAD_MUTEX_INIT is defined.  */
namespace std
{
    inline unsigned long
	_Atomic_swap(unsigned long * __p, unsigned long __q) 
	{
	    int i = intLock();
	    unsigned long __result = *__p;
	    *__p = __q;
	    intUnlock (i);
	    return __result;
	}
}
#endif





More information about the Libstdc++ mailing list