ecl/src/h/ecl-atomic-ops.h
Marius Gerbershagen 6ce7ebc19f threading: fix race conditions when interrupted while pushing in the bindings stack
If ecl_bds_push or ecl_bds_bind were interrupted by a call to
    ecl_bds_unwind, segementation faults could occur, because
    env->bds_top->symbol may not have pointed to a valid symbol.
    Also, memory corruption was possible if the functions were
    interrupted after setting slot->symbol but before setting
    slot->value.
2018-02-11 22:20:24 +01:00

34 lines
885 B
C

/* -*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*- */
/* vim: set filetype=c tabstop=8 shiftwidth=4 expandtab: */
/*
ecl-atomic-ops.h -- Wrapper around libatomic_ops functions
*/
/*
Copyright (c) 2001, Juan Jose Garcia Ripoll.
ECL is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
See file '../Copyright' for full details.
*/
#ifndef ECL_ATOMIC_OPS_H
#define ECL_ATOMIC_OPS_H
#ifdef ECL_THREADS
# define AO_REQUIRE_CAS
# ifdef ECL_LIBATOMIC_OPS_H
# include <ecl/atomic_ops.h>
# else
# include <atomic_ops.h>
# endif
#else
# define AO_load(x) (x)
# define AO_store(x,y) ((x)=(y))
# define AO_store_full(x,y) ((x)=(y))
#endif
#endif /* ECL_ATOMIC_OPS_H */