github.com/axw/llgo@v0.0.0-20160805011314-95b5fe4dca20/third_party/gofrontend/libgo/go/sync/cas.c (about)

     1  /* cas.c -- implement sync.cas for Go.
     2  
     3     Copyright 2009 The Go Authors. All rights reserved.
     4     Use of this source code is governed by a BSD-style
     5     license that can be found in the LICENSE file.  */
     6  
     7  #include <stdint.h>
     8  
     9  #include "runtime.h"
    10  
    11  _Bool cas (int32_t *, int32_t, int32_t) __asm__ (GOSYM_PREFIX "libgo_sync.sync.cas");
    12  
    13  _Bool
    14  cas (int32_t *ptr, int32_t old, int32_t new)
    15  {
    16    return __sync_bool_compare_and_swap (ptr, old, new);
    17  }