Changeset 30112 in vbox for trunk/include
- Timestamp:
- Jun 9, 2010 12:31:50 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 62507
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm.h
r30111 r30112 2416 2416 * Atomically writes a pointer value, ordered. 2417 2417 * 2418 * @returns Current *pv value2419 2418 * @param ppv Pointer to the pointer variable. 2420 2419 * @param pv The pointer value to assign to *ppv. … … 2433 2432 2434 2433 /** 2435 * Convenience macro for avoiding the annoying casting with ASMAtomicWritePtr. 2436 * 2437 * @returns Current *pv value 2434 * Atomically writes a pointer value, ordered. 2435 * 2438 2436 * @param ppv Pointer to the pointer variable. 2439 * @param pv The pointer value to assign to *ppv. If NULL , you may have2440 * to cast it to the right pointer type for GCC to be happy.2437 * @param pv The pointer value to assign to *ppv. If NULL use 2438 * ASMAtomicWriteNullPtr or you'll land in trouble. 2441 2439 * 2442 2440 * @remarks This is relatively type safe on GCC platforms when @a pv isn't … … 2470 2468 2471 2469 /** 2472 * Convenience macro for avoiding the annoying casting involved when using 2473 * ASMAtomicWritePtr. 2470 * Atomically sets a pointer to NULL, ordered. 2471 * 2472 * @param ppv Pointer to the pointer variable that should be set to NULL. 2473 * 2474 * @remarks This is relatively type safe on GCC platforms. 2475 */ 2476 #ifdef __GNUC__ 2477 # define ASMAtomicWriteNullPtr(ppv) \ 2478 do \ 2479 { \ 2480 __typeof__(*(ppv)) volatile * const ppvTypeChecked = (ppv); \ 2481 AssertCompile(sizeof(*ppv) == sizeof(void *)); \ 2482 Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \ 2483 ASMAtomicWritePtrVoid((void * volatile *)(ppvTypeChecked), NULL); \ 2484 } while (0) 2485 #else 2486 # define ASMAtomicWriteNullPtr(ppv) \ 2487 do \ 2488 { \ 2489 AssertCompile(sizeof(*ppv) == sizeof(void *)); \ 2490 Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \ 2491 ASMAtomicWritePtrVoid((void * volatile *)(ppv), NULL); \ 2492 } while (0) 2493 #endif 2494 2495 2496 /** 2497 * Atomically writes a pointer value, unordered. 2474 2498 * 2475 2499 * @returns Current *pv value 2476 2500 * @param ppv Pointer to the pointer variable. 2477 * @param pv The pointer value to assign to *ppv. 2501 * @param pv The pointer value to assign to *ppv. If NULL use 2502 * ASMAtomicUoWriteNullPtr or you'll land in trouble. 2478 2503 * 2479 2504 * @remarks This is relatively type safe on GCC platforms when @a pv isn't … … 2501 2526 Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \ 2502 2527 *(ppv) = pv; \ 2528 } while (0) 2529 #endif 2530 2531 2532 /** 2533 * Atomically sets a pointer to NULL, unordered. 2534 * 2535 * @param ppv Pointer to the pointer variable that should be set to NULL. 2536 * 2537 * @remarks This is relatively type safe on GCC platforms. 2538 */ 2539 #ifdef __GNUC__ 2540 # define ASMAtomicUoWriteNullPtr(ppv) \ 2541 do \ 2542 { \ 2543 __typeof__(*(ppv)) volatile * const ppvTypeChecked = (ppv); \ 2544 AssertCompile(sizeof(*ppv) == sizeof(void *)); \ 2545 Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \ 2546 *(ppvTypeChecked) = NULL; \ 2547 } while (0) 2548 #else 2549 # define ASMAtomicUoWriteNullPtr(ppv) \ 2550 do \ 2551 { \ 2552 AssertCompile(sizeof(*ppv) == sizeof(void *)); \ 2553 Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \ 2554 *(ppv) = NULL; \ 2503 2555 } while (0) 2504 2556 #endif
Note:
See TracChangeset
for help on using the changeset viewer.