#include <OS_NS_Thread.h>
Public Member Functions | |
ACE_TSS_Keys (void) | |
Default constructor, to initialize all bits to zero (unused). | |
int | test_and_set (const ACE_thread_key_t key) |
int | test_and_clear (const ACE_thread_key_t key) |
int | is_set (const ACE_thread_key_t key) const |
Private Types | |
enum | { ACE_WORDS = (ACE_DEFAULT_THREAD_KEYS - 1) / ACE_BITS_PER_WORD + 1 } |
Static Private Member Functions | |
void | find (const u_int key, u_int &word, u_int &bit) |
For a given key, find the word and bit number that represent it. | |
Private Attributes | |
u_long | key_bit_words_ [ACE_WORDS] |
Wrapper around array of whether each key is in use. A simple typedef doesn't work with Sun C++ 4.2.
Definition at line 978 of file OS_NS_Thread.h.
|
Definition at line 1000 of file OS_NS_Thread.h.
01001 { 01002 # if ACE_SIZEOF_LONG == 8 01003 ACE_BITS_PER_WORD = 64, 01004 # elif ACE_SIZEOF_LONG == 4 01005 ACE_BITS_PER_WORD = 32, 01006 # else 01007 # error ACE_TSS_Keys only supports 32 or 64 bit longs. 01008 # endif /* ACE_SIZEOF_LONG == 8 */ 01009 ACE_WORDS = (ACE_DEFAULT_THREAD_KEYS - 1) / ACE_BITS_PER_WORD + 1 01010 }; |
|
Default constructor, to initialize all bits to zero (unused).
Definition at line 519 of file OS_NS_Thread.cpp. References ACE_WORDS, and key_bit_words_.
00520 { 00521 for (u_int i = 0; i < ACE_WORDS; ++i) 00522 { 00523 key_bit_words_[i] = 0; 00524 } 00525 } |
|
For a given key, find the word and bit number that represent it.
Definition at line 529 of file OS_NS_Thread.cpp. Referenced by is_set(), test_and_clear(), and test_and_set().
00530 { 00531 word = key / ACE_BITS_PER_WORD; 00532 bit = key % ACE_BITS_PER_WORD; 00533 } |
|
Return whether the specific key is marked as in use. Returns 1 if the key is been marked, 0 if not. Definition at line 572 of file OS_NS_Thread.cpp. References ACE_BIT_ENABLED, ACE_KEY_INDEX, ACE_thread_key_t, ACE_WORDS, find(), and key_bit_words_.
00573 { 00574 ACE_KEY_INDEX (key_index, key); 00575 u_int word, bit; 00576 find (key_index, word, bit); 00577 00578 return word < ACE_WORDS ? ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit) : 0; 00579 } |
|
Mark the specified key as not being in use, if it was not already so cleared. Returns 1 if the key had already been cleared, 0 if not. Definition at line 554 of file OS_NS_Thread.cpp. References ACE_BIT_ENABLED, ACE_CLR_BITS, ACE_KEY_INDEX, ACE_thread_key_t, ACE_WORDS, find(), and key_bit_words_. Referenced by ACE_TSS_Cleanup::thread_release().
00555 { 00556 ACE_KEY_INDEX (key_index, key); 00557 u_int word, bit; 00558 find (key_index, word, bit); 00559 00560 if (word < ACE_WORDS && ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit)) 00561 { 00562 ACE_CLR_BITS (key_bit_words_[word], 1 << bit); 00563 return 0; 00564 } 00565 else 00566 { 00567 return 1; 00568 } 00569 } |
|
Mark the specified key as being in use, if it was not already so marked. Returns 1 if the had already been marked, 0 if not. Definition at line 536 of file OS_NS_Thread.cpp. References ACE_BIT_ENABLED, ACE_KEY_INDEX, ACE_SET_BITS, ACE_thread_key_t, find(), and key_bit_words_. Referenced by ACE_TSS_Cleanup::thread_use_key().
00537 { 00538 ACE_KEY_INDEX (key_index, key); 00539 u_int word, bit; 00540 find (key_index, word, bit); 00541 00542 if (ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit)) 00543 { 00544 return 1; 00545 } 00546 else 00547 { 00548 ACE_SET_BITS (key_bit_words_[word], 1 << bit); 00549 return 0; 00550 } 00551 } |
|
Bit flag collection. A bit value of 1 indicates that the key is in use by this thread. Definition at line 1014 of file OS_NS_Thread.h. Referenced by ACE_TSS_Keys(), is_set(), test_and_clear(), and test_and_set(). |