Espacios de nombres
Variantes
Acciones

std::atomic

De cppreference.com
< cpp‎ | atomic


 
 
Operaciones de biblioteca Atómica
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
atomic
(C++11)
Funciones
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Banderas atómicas
Original:
Atomic flags
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inicialización
Original:
Initialization
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Memoria pedido
Original:
Memory ordering
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::atomic
Las funciones miembro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funciones especializadas miembros
Original:
Specialized member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Definido en la cabecera <atomic>
template< class T >
struct atomic;
(1) (desde C++11)
template<>
struct atomic<Integral>;
(2) (desde C++11)
template< class T >
struct atomic<T*>;
(3) (desde C++11)
Cada especialización completa de la plantilla std::atomic define un tipo atómico. Los objetos de tipos atómicos son los únicos objetos de C + + que están libres de carreras de datos, es decir, si un hilo escribe en un objeto atómico mientras otro hilo lee del mismo objeto, el comportamiento es bien definido .
Original:
Each full specialization of the std::atomic template defines an atomic type. Objects of atomic types are the only C++ objects that are free from data races; that is, if one thread writes to an atomic object while another thread reads from it, the behavior is well-defined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Además, los accesos a objetos atómicos podrían establecer cierta sincronización entre hilos y ordenar los accesos no atómicos a memoria según lo especificado por std::memory_order .
Original:
In addition, accesses to atomic objects may establish inter-thread synchronization and order non-atomic memory accesses as specified by std::memory_order.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La biblioteca estándar proporciona especializaciones completas de la plantilla std::atomic para los siguientes tipos:
Original:
The standard library provides full specializations of the std::atomic template for the following types:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Se define una especialización para el tipo bool y su nombre typedef, que se trata como un std::atomic<T> no especializado, excepto que tiene disposición estándar, constructor predeterminado trivial, destructores triviales, y es compatible con la sintaxis de inicialización de agregados:
Original:
One specialization for the type bool and its typedef name is defined that is treated as a non-specialized std::atomic<T> except that it has standard layout, trivial default constructor, trivial destructors, and supports aggregate initialization syntax:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
nombre typedef
Original:
Typedef name
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Full specialization
std::atomic_bool std::atomic<bool>
2)
Especializaciones y typedefs para tipos integrales, como sigue:
Original:
Specializations and typedefs for integral types, as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
nombre typedef
Original:
Typedef name
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Full specialization
std::atomic_char std::atomic<char>
std::atomic_schar std::atomic<signed char>
std::atomic_uchar std::atomic<unsigned char>
std::atomic_short std::atomic<short>
std::atomic_ushort std::atomic<unsigned short>
std::atomic_int std::atomic<int>
std::atomic_uint std::atomic<unsigned int>
std::atomic_long std::atomic<long>
std::atomic_ulong std::atomic<unsigned long>
std::atomic_llong std::atomic<long long>
std::atomic_ullong std::atomic<unsigned long long>
std::atomic_char16_t std::atomic<char16_t>
std::atomic_char32_t std::atomic<char32_t>
std::atomic_wchar_t std::atomic<wchar_t>
std::atomic_int_least8_t std::atomic<int_least8_t>
std::atomic_uint_least8_t std::atomic<uint_least8_t>
std::atomic_int_least16_t std::atomic<int_least16_t>
std::atomic_uint_least16_t std::atomic<uint_least16_t>
std::atomic_int_least32_t std::atomic<int_least32_t>
std::atomic_uint_least32_t std::atomic<uint_least32_t>
std::atomic_int_least64_t std::atomic<int_least64_t>
std::atomic_uint_least64_t std::atomic<uint_least64_t>
std::atomic_int_fast8_t std::atomic<int_fast8_t>
std::atomic_uint_fast8_t std::atomic<uint_fast8_t>
std::atomic_int_fast16_t std::atomic<int_fast16_t>
std::atomic_uint_fast16_t std::atomic<uint_fast16_t>
std::atomic_int_fast32_t std::atomic<int_fast32_t>
std::atomic_uint_fast32_t std::atomic<uint_fast32_t>
std::atomic_int_fast64_t std::atomic<int_fast64_t>
std::atomic_uint_fast64_t std::atomic<uint_fast64_t>
std::atomic_intptr_t std::atomic<intptr_t>
std::atomic_uintptr_t std::atomic<uintptr_t>
std::atomic_size_t std::atomic<size_t>
std::atomic_ptrdiff_t std::atomic<ptrdiff_t>
std::atomic_intmax_t std::atomic<intmax_t>
std::atomic_uintmax_t std::atomic<uintmax_t>
Estas especializaciones tienen disposición estándar, constructores triviales predeterminados y destructores triviales. Soportan la sintaxis de inicialización total .
Original:
These specializations have standard layout, trivial default constructors, and trivial destructors. They support aggregate initialization syntax.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
std::atomic<T*> para todo tipo de puntero. Estas especializaciones tienen disposición estándar, constructores triviales predeterminados y destructores triviales. Soportan agregado
Original:
std::atomic<T*> for all pointer types. These specializations have standard layout, trivial default constructors, and trivial destructors. They support aggregate
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
inicialización de sintaxis .
Original:
initialization syntax.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Las funciones miembro

construye un objeto atómico
Original:
constructs an atomic object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
almacena un valor en un objeto atómico
Original:
stores a value into an atomic object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
comprueba si el objeto atómico es sin bloqueo
Original:
checks if the atomic object is lock-free
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
(C++11)
atómicamente sustituye el valor del objeto atómico con un argumento no atómica
Original:
atomically replaces the value of the atomic object with a non-atomic argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
(C++11)
atómicamente obtiene el valor del objeto atómica
Original:
atomically obtains the value of the atomic object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
carga un valor de un objeto atómico
Original:
loads a value from an atomic object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
(C++11)
automáticamente reemplazado el valor del objeto atómico y obtiene el valor que tenía antes
Original:
atomically replaced the value of the atomic object and obtains the value held previously
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
atómicamente compara el valor del objeto atómica con no atómica argumento y realiza intercambio atómico si carga igual o atómica si no
Original:
atomically compares the value of the atomic object with non-atomic argument and performs atomic exchange if equal or atomic load if not
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]

[editar] Funciones especializadas miembros

(C++11)
atómicamente agrega el argumento con el valor almacenado en el objeto atómico y obtiene el valor que tenía antes
Original:
atomically adds the argument to the value stored in the atomic object and obtains the value held previously
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
(C++11)
atómicamente resta el argumento de que el valor almacenado en el objeto atómico y obtiene el valor que tenía antes
Original:
atomically subtracts the argument from the value stored in the atomic object and obtains the value held previously
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
(C++11)
realiza atómicamente AND bit a bit entre el argumento y el valor del objeto atómico y obtiene el valor que tenía antes
Original:
atomically performs bitwise AND between the argument and the value of the atomic object and obtains the value held previously
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
(C++11)
atomically performs bitwise OR between the argument and the value of the atomic object and obtains the value held previously
(función miembro público) [editar]
(C++11)
atómicamente realiza bit a bit XOR entre el argumento y el valor del objeto atómico y obtiene el valor que tenía antes
Original:
atomically performs bitwise XOR between the argument and the value of the atomic object and obtains the value held previously
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
aumenta o disminuye el valor atómico por uno
Original:
increments or decrements the atomic value by one
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]
suma, resta, o presta XOR bit a bit AND, OR, con el valor atómico
Original:
adds, subtracts, or performs bitwise AND, OR, XOR with the atomic value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]

[editar] Notas

Hay plantillas de función no miembro equivalentes para todas las funciones miembro de std::atomic. Estas funciones no miembro pueden ser sobrecargadas adicionalmente para tipos que no son especializaciones de std::atomic, pero son capaces de garantizar la atomicidad. El único tipo en la biblioteca estándar que cumple este requisito es std::shared_ptr<T> .
Original:
There are non-member function template equivalents for all member functions of std::atomic. Those non-member functions may be additionally overloaded for types that are not specializations of std::atomic, but are able to guarantee atomicity. The only such type in the standard library is std::shared_ptr<T>.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ver también

el bloqueo libre de tipo atómico booleano
Original:
the lock-free boolean atomic type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(clase) [editar]