Changeset 25295 in vbox for trunk/include/iprt
- Timestamp:
- Dec 10, 2009 1:12:41 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/thread.h
r25294 r25295 666 666 667 667 /** 668 * Allocates a TLS entry (index). Before using an item of TLS, this must be called 669 * once for the process; the RTTLS value returned is then typically stored in a global 670 * or static variable. See RTTlsGet() for example code. 668 * Allocates a TLS entry (index). 669 * 670 * Example code: 671 * @code 672 RTTLS g_iTls = NIL_RTTLS; 673 674 ... 675 676 // once for the process, allocate the TLS index 677 if (g_iTls == NIL_RTTLS) 678 g_iTls = RTTlsAlloc(); 679 680 // set the thread-local value. 681 RTTlsSet(g_iTls, pMyData); 682 683 ... 684 685 // get the thread-local value 686 PMYDATA pMyData = (PMYDATA)RTTlsGet(g_iTls); 687 688 @endcode 671 689 * 672 690 * @returns the index of the allocated TLS entry. … … 676 694 677 695 /** 678 * Allocates a TLS entry (index, with status code).696 * Variant of RTTlsAlloc that returns a status code. 679 697 * 680 698 * @returns IPRT status code. … … 700 718 /** 701 719 * Get the (thread-local) value stored in a TLS entry. 702 * If RTTlsSet() has not yet been called, returns NULL.703 *704 * Example code:705 * <code>706 * RTTLS g_globalTLSIndex = NIL_RTTLS;707 *708 * ...709 *710 * // once for the process, allocate the TLS index711 * if (g_globalTLSIndex == NIL_RTTLS)712 * g_globalTLSIndex = RTTlsAlloc();713 *714 * // get the thread-local value715 * void* pv = RTTlsGet(g_globalTLSIndex);716 *717 * </code>718 720 * 719 721 * @returns value in given TLS entry. 720 * @returns NULL on failure. 722 * @retval NULL if RTTlsSet() has not yet been called on this thread, or if the 723 * TLS index is invalid. 724 * 721 725 * @param iTls The index of the TLS entry. 722 726 */ … … 728 732 * @returns IPRT status code. 729 733 * @param iTls The index of the TLS entry. 730 * @param ppvValue Where to store the value. 734 * @param ppvValue Where to store the value. The value will be NULL if 735 * RTTlsSet has not yet been called on this thread. 731 736 */ 732 737 RTR3DECL(int) RTTlsGetEx(RTTLS iTls, void **ppvValue);
Note:
See TracChangeset
for help on using the changeset viewer.