vm: forgot to add atomic.hpp

db4
Joe Groff 2011-11-01 21:16:40 -07:00
parent 7de62e8dbb
commit 2fc6b0b9be
1 changed files with 27 additions and 0 deletions

27
vm/atomic.hpp Normal file
View File

@ -0,0 +1,27 @@
namespace factor {
namespace atomic {
FACTOR_FORCE_INLINE static cell load(volatile cell *ptr)
{
atomic::fence();
return *ptr;
}
FACTOR_FORCE_INLINE static fixnum load(volatile fixnum *ptr)
{
atomic::fence();
return *ptr;
}
FACTOR_FORCE_INLINE static void store(volatile cell *ptr, cell val)
{
*ptr = val;
atomic::fence();
}
FACTOR_FORCE_INLINE static void store(volatile fixnum *ptr, fixnum val)
{
*ptr = val;
atomic::fence();
}
}
}