This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lbianc
Recipients Arfrever, Joshua.J.Cogliati, Vitor.de.Lima, gustavotemple, jrincayc, lbianc, python-dev, vstinner
Date 2015-03-16.13:55:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426514135.01.0.908994680994.issue23644@psf.upfronthosting.co.za>
In-reply-to
Content
@haypo

For adding compatibility for atomics based on @Joshua.J.Cogliati change, I propose:

#ifndef Py_LIMITED_API
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H

#include "dynamic_annotations.h"

#include "pyconfig.h"

#if defined(HAVE_STD_ATOMIC)
#ifdef __cplusplus
#include <atomic>
#define _Atomic(T) atomic<T>
using namespace std;
#else
#include <stdatomic.h>
#endif
#endif

#ifdef __cplusplus
extern "C" {
#endif


/* This is modeled after the atomics interface from C1x, according to
 * the draft at
 * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf.
 * Operations and types are named the same except with a _Py_ prefix
 * and have the same semantics.
 *
 * Beware, the implementations here are deep magic.
 */

#if defined(HAVE_STD_ATOMIC)

typedef enum _Py_memory_order {
    _Py_memory_order_relaxed = memory_order_relaxed,
    _Py_memory_order_acquire = memory_order_acquire,
    _Py_memory_order_release = memory_order_release,
    _Py_memory_order_acq_rel = memory_order_acq_rel,
    _Py_memory_order_seq_cst = memory_order_seq_cst
} _Py_memory_order;

typedef struct _Py_atomic_address {
    _Atomic (void) *_value;
} _Py_atomic_address;

typedef struct _Py_atomic_int {
    atomic_int _value;
} _Py_atomic_int;


... (rest same)
History
Date User Action Args
2015-03-16 13:55:35lbiancsetrecipients: + lbianc, vstinner, Arfrever, jrincayc, python-dev, Joshua.J.Cogliati, Vitor.de.Lima, gustavotemple
2015-03-16 13:55:35lbiancsetmessageid: <1426514135.01.0.908994680994.issue23644@psf.upfronthosting.co.za>
2015-03-16 13:55:34lbianclinkissue23644 messages
2015-03-16 13:55:34lbianccreate