stingergraph / StingerGraphs.jl

Julialang bindings to the STINGER graph database
http://www.stingergraph.com
Other
5 stars 3 forks source link

atomics #22

Closed jpfairbanks closed 7 years ago

jpfairbanks commented 7 years ago

I think the

function atomic_cas!(x::Array{T}, i::Int, cmp::T, new::T)
    ptr = pointer(x) + i*sizof(T)
    llvmcall($"""
                         %rs = cmpxchg $lt* %0, $lt %1, $lt %2 acq_rel acquire
                         %rv = extractvalue { $lt, i1 } %rs, 0
                         ret $lt %rv
                         """, $typ, Tuple{Ptr{$typ},$typ,$typ},
                         ptr, cmp, new)
end

stuff would be a really great contribution to base julia.

rohitvarkey commented 7 years ago

See UnsafeAtomics.jl as a starting point for this.