|
From: <axl...@us...> - 2010-11-23 03:04:23
|
Revision: 770
http://hgengine.svn.sourceforge.net/hgengine/?rev=770&view=rev
Author: axlecrusher
Date: 2010-11-23 03:04:17 +0000 (Tue, 23 Nov 2010)
Log Message:
-----------
add CAS_PTR and license on MercuryThreads
Modified Paths:
--------------
Mercury2/src/MSemaphore.h
Mercury2/src/MercuryThreads.cpp
Mercury2/src/MercuryThreads.h
Modified: Mercury2/src/MSemaphore.h
===================================================================
--- Mercury2/src/MSemaphore.h 2010-11-21 19:38:18 UTC (rev 769)
+++ Mercury2/src/MSemaphore.h 2010-11-23 03:04:17 UTC (rev 770)
@@ -13,15 +13,21 @@
#define COMPARE_AND_SWAP(d,o,n) __sync_val_compare_and_swap(d,o,n)
#define SYNC_AND_AND_FETCH(d,v) __sync_and_and_fetch(d,v)
+inline void* CAS_PTR(volatile void** d, void* e, void* c)
+{
+ //these variables must be 32 bit aligned on x86 and 64 bit aligned on x64
+ return __sync_val_compare_and_swap((void**)d,c,e);
+}
+
#else
#define SYNC_OR_AND_FETCH(d,v) ((uint32_t)OrAndFetch(d,v))
#define COMPARE_AND_SWAP(d,o,n) ((uint32_t)InterlockedCompareExchange(d, n, o))
#define SYNC_AND_AND_FETCH(d,v) ((uint32_t)__sync_and_and_fetch(d,v))
-inline void* CAS_PTR(volatile void** d, void* e, void* c)
-{
- //these variables must be 32 bit aligned on x86 and 64 bit aligned on x64
+inline void* CAS_PTR(volatile void** d, void* e, void* c)
+{
+ //these variables must be 32 bit aligned on x86 and 64 bit aligned on x64
return InterlockedCompareExchangePointer((volatile PVOID*)d,e,c);
}
Modified: Mercury2/src/MercuryThreads.cpp
===================================================================
--- Mercury2/src/MercuryThreads.cpp 2010-11-21 19:38:18 UTC (rev 769)
+++ Mercury2/src/MercuryThreads.cpp 2010-11-23 03:04:17 UTC (rev 770)
@@ -306,3 +306,35 @@
return 0;
#endif
}
+
+/****************************************************************************
+ * Copyright (C) 2006 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Modified: Mercury2/src/MercuryThreads.h
===================================================================
--- Mercury2/src/MercuryThreads.h 2010-11-21 19:38:18 UTC (rev 769)
+++ Mercury2/src/MercuryThreads.h 2010-11-23 03:04:17 UTC (rev 770)
@@ -190,3 +190,34 @@
#endif
+/****************************************************************************
+ * Copyright (C) 2006 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|