|
2267 | 2267 | \pnum\returns \tcode{use_count() == 1}.
|
2268 | 2268 | \end{itemdescr}
|
2269 | 2269 |
|
| 2270 | +\rSec1[depr.util.smartptr.shared.atomic]{Deprecated \tcode{shared_ptr} atomic access} |
| 2271 | + |
| 2272 | +\pnum |
| 2273 | +The header \tcode{<memory>} has the following additions: |
| 2274 | + |
| 2275 | +\indexlibrary{\idxcode{shared_ptr}}% |
| 2276 | +\begin{codeblock} |
| 2277 | +namespace std { |
| 2278 | + template<class T> |
| 2279 | + bool atomic_is_lock_free(const shared_ptr<T>* p); |
| 2280 | + |
| 2281 | + template<class T> |
| 2282 | + shared_ptr<T> atomic_load(const shared_ptr<T>* p); |
| 2283 | + template<class T> |
| 2284 | + shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo); |
| 2285 | + |
| 2286 | + template<class T> |
| 2287 | + void atomic_store(shared_ptr<T>* p, shared_ptr<T> r); |
| 2288 | + template<class T> |
| 2289 | + void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo); |
| 2290 | + |
| 2291 | + template<class T> |
| 2292 | + shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r); |
| 2293 | + template<class T> |
| 2294 | + shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo); |
| 2295 | + |
| 2296 | + template<class T> |
| 2297 | + bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w); |
| 2298 | + template<class T> |
| 2299 | + bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w); |
| 2300 | + template<class T> |
| 2301 | + bool atomic_compare_exchange_weak_explicit( |
| 2302 | + shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, |
| 2303 | + memory_order success, memory_order failure); |
| 2304 | + template<class T> |
| 2305 | + bool atomic_compare_exchange_strong_explicit( |
| 2306 | + shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, |
| 2307 | + memory_order success, memory_order failure); |
| 2308 | +} |
| 2309 | +\end{codeblock} |
| 2310 | + |
| 2311 | +\pnum |
| 2312 | +Concurrent access to a \tcode{shared_ptr} object from multiple threads does not |
| 2313 | +introduce a data race if the access is done exclusively via the functions in |
| 2314 | +this subclause and the instance is passed as their first argument. |
| 2315 | + |
| 2316 | +\pnum |
| 2317 | +The meaning of the arguments of type \tcode{memory_order} is explained in~\ref{atomics.order}. |
| 2318 | + |
| 2319 | +\indexlibrarymember{atomic_is_lock_free}{shared_ptr}% |
| 2320 | +\begin{itemdecl} |
| 2321 | +template<class T> bool atomic_is_lock_free(const shared_ptr<T>* p); |
| 2322 | +\end{itemdecl} |
| 2323 | + |
| 2324 | +\begin{itemdescr} |
| 2325 | +\pnum |
| 2326 | +\requires \tcode{p} shall not be null. |
| 2327 | + |
| 2328 | +\pnum |
| 2329 | +\returns \tcode{true} if atomic access to \tcode{*p} is lock-free, \tcode{false} otherwise. |
| 2330 | + |
| 2331 | +\pnum |
| 2332 | +\throws Nothing. |
| 2333 | +\end{itemdescr} |
| 2334 | + |
| 2335 | +\indexlibrarymember{atomic_load}{shared_ptr}% |
| 2336 | +\begin{itemdecl} |
| 2337 | +template<class T> shared_ptr<T> atomic_load(const shared_ptr<T>* p); |
| 2338 | +\end{itemdecl} |
| 2339 | + |
| 2340 | +\begin{itemdescr} |
| 2341 | +\pnum |
| 2342 | +\requires \tcode{p} shall not be null. |
| 2343 | + |
| 2344 | +\pnum |
| 2345 | +\returns \tcode{atomic_load_explicit(p, memory_order_seq_cst)}. |
| 2346 | + |
| 2347 | +\pnum |
| 2348 | +\throws Nothing. |
| 2349 | +\end{itemdescr} |
| 2350 | + |
| 2351 | +\indexlibrarymember{atomic_load_explicit}{shared_ptr}% |
| 2352 | +\begin{itemdecl} |
| 2353 | +template<class T> shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo); |
| 2354 | +\end{itemdecl} |
| 2355 | + |
| 2356 | +\begin{itemdescr} |
| 2357 | +\pnum |
| 2358 | +\requires \tcode{p} shall not be null. |
| 2359 | + |
| 2360 | +\pnum |
| 2361 | +\requires \tcode{mo} shall not be \tcode{memory_order_release} or \tcode{memory_order_acq_rel}. |
| 2362 | + |
| 2363 | +\pnum |
| 2364 | +\returns \tcode{*p}. |
| 2365 | + |
| 2366 | +\pnum |
| 2367 | +\throws Nothing. |
| 2368 | +\end{itemdescr} |
| 2369 | + |
| 2370 | +\indexlibrarymember{atomic_store}{shared_ptr}% |
| 2371 | +\begin{itemdecl} |
| 2372 | +template<class T> void atomic_store(shared_ptr<T>* p, shared_ptr<T> r); |
| 2373 | +\end{itemdecl} |
| 2374 | + |
| 2375 | +\begin{itemdescr} |
| 2376 | +\pnum |
| 2377 | +\requires \tcode{p} shall not be null. |
| 2378 | + |
| 2379 | +\pnum |
| 2380 | +\effects As if by \tcode{atomic_store_explicit(p, r, memory_order_seq_cst)}. |
| 2381 | + |
| 2382 | +\pnum |
| 2383 | +\throws Nothing. |
| 2384 | +\end{itemdescr} |
| 2385 | + |
| 2386 | +\indexlibrarymember{atomic_store_explicit}{shared_ptr}% |
| 2387 | +\begin{itemdecl} |
| 2388 | +template<class T> void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo); |
| 2389 | +\end{itemdecl} |
| 2390 | + |
| 2391 | +\begin{itemdescr} |
| 2392 | +\pnum |
| 2393 | +\requires \tcode{p} shall not be null. |
| 2394 | + |
| 2395 | +\pnum |
| 2396 | +\requires \tcode{mo} shall not be \tcode{memory_order_acquire} or \tcode{memory_order_acq_rel}. |
| 2397 | + |
| 2398 | +\pnum |
| 2399 | +\effects As if by \tcode{p->swap(r)}. |
| 2400 | + |
| 2401 | +\pnum |
| 2402 | +\throws Nothing. |
| 2403 | +\end{itemdescr} |
| 2404 | + |
| 2405 | +\indexlibrarymember{atomic_exchange}{shared_ptr}% |
| 2406 | +\begin{itemdecl} |
| 2407 | +template<class T> shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r); |
| 2408 | +\end{itemdecl} |
| 2409 | + |
| 2410 | +\begin{itemdescr} |
| 2411 | +\pnum |
| 2412 | +\requires \tcode{p} shall not be null. |
| 2413 | + |
| 2414 | +\pnum |
| 2415 | +\returns \tcode{atomic_exchange_explicit(p, r, memory_order_seq_cst)}. |
| 2416 | + |
| 2417 | +\pnum |
| 2418 | +\throws Nothing. |
| 2419 | +\end{itemdescr} |
| 2420 | + |
| 2421 | +\indexlibrarymember{atomic_exchange_explicit}{shared_ptr}% |
| 2422 | +\begin{itemdecl} |
| 2423 | +template<class T> |
| 2424 | + shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo); |
| 2425 | +\end{itemdecl} |
| 2426 | + |
| 2427 | +\begin{itemdescr} |
| 2428 | +\pnum |
| 2429 | +\requires \tcode{p} shall not be null. |
| 2430 | + |
| 2431 | +\pnum |
| 2432 | +\effects As if by \tcode{p->swap(r)}. |
| 2433 | + |
| 2434 | +\pnum |
| 2435 | +\returns The previous value of \tcode{*p}. |
| 2436 | + |
| 2437 | +\pnum |
| 2438 | +\throws Nothing. |
| 2439 | +\end{itemdescr} |
| 2440 | + |
| 2441 | +\indexlibrarymember{atomic_compare_exchange_weak}{shared_ptr}% |
| 2442 | +\begin{itemdecl} |
| 2443 | +template<class T> |
| 2444 | + bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w); |
| 2445 | +\end{itemdecl} |
| 2446 | + |
| 2447 | +\begin{itemdescr} |
| 2448 | +\pnum |
| 2449 | +\requires \tcode{p} shall not be null and \tcode{v} shall not be null. |
| 2450 | + |
| 2451 | +\pnum |
| 2452 | +\returns |
| 2453 | +\begin{codeblock} |
| 2454 | +atomic_compare_exchange_weak_explicit(p, v, w, memory_order_seq_cst, memory_order_seq_cst) |
| 2455 | +\end{codeblock} |
| 2456 | + |
| 2457 | +\pnum |
| 2458 | +\throws Nothing. |
| 2459 | +\end{itemdescr} |
| 2460 | + |
| 2461 | +\indexlibrarymember{atomic_compare_exchange_strong}{shared_ptr}% |
| 2462 | +\begin{itemdecl} |
| 2463 | +template<class T> |
| 2464 | + bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w); |
| 2465 | +\end{itemdecl} |
| 2466 | + |
| 2467 | +\begin{itemdescr} |
| 2468 | +\pnum |
| 2469 | +\returns |
| 2470 | +\begin{codeblock} |
| 2471 | +atomic_compare_exchange_strong_explicit(p, v, w, memory_order_seq_cst, memory_order_seq_cst) |
| 2472 | +\end{codeblock} |
| 2473 | +\end{itemdescr} |
| 2474 | + |
| 2475 | +\indexlibrarymember{atomic_compare_exchange_weak_explicit}{shared_ptr}% |
| 2476 | +\indexlibrarymember{atomic_compare_exchange_strong_explicit}{shared_ptr}% |
| 2477 | +\begin{itemdecl} |
| 2478 | +template<class T> |
| 2479 | + bool atomic_compare_exchange_weak_explicit( |
| 2480 | + shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, |
| 2481 | + memory_order success, memory_order failure); |
| 2482 | +template<class T> |
| 2483 | + bool atomic_compare_exchange_strong_explicit( |
| 2484 | + shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, |
| 2485 | + memory_order success, memory_order failure); |
| 2486 | +\end{itemdecl} |
| 2487 | + |
| 2488 | +\begin{itemdescr} |
| 2489 | +\pnum |
| 2490 | +\requires \tcode{p} shall not be null and \tcode{v} shall not be null. |
| 2491 | +The \tcode{failure} argument shall not be \tcode{memory_order_release} nor |
| 2492 | +\tcode{memory_order_acq_rel}. |
| 2493 | + |
| 2494 | +\pnum |
| 2495 | +\effects If \tcode{*p} is equivalent to \tcode{*v}, assigns \tcode{w} to |
| 2496 | +\tcode{*p} and has synchronization semantics corresponding to the value of |
| 2497 | +\tcode{success}, otherwise assigns \tcode{*p} to \tcode{*v} and has |
| 2498 | +synchronization semantics corresponding to the value of \tcode{failure}. |
| 2499 | + |
| 2500 | +\pnum |
| 2501 | +\returns \tcode{true} if \tcode{*p} was equivalent to \tcode{*v}, \tcode{false} otherwise. |
| 2502 | + |
| 2503 | +\pnum |
| 2504 | +\throws Nothing. |
| 2505 | + |
| 2506 | +\pnum |
| 2507 | +\remarks Two \tcode{shared_ptr} objects are equivalent if they store the same |
| 2508 | +pointer value and share ownership. |
| 2509 | +The weak form may fail spuriously. See~\ref{atomics.types.operations}. |
| 2510 | +\end{itemdescr} |
| 2511 | + |
2270 | 2512 | \rSec1[depr.locale.stdcvt]{Deprecated standard code conversion facets}
|
2271 | 2513 |
|
2272 | 2514 | \pnum
|
|
0 commit comments