#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 979 of file OS_NS_Thread.h.
|
|
Definition at line 1001 of file OS_NS_Thread.h.
01002 {
01003 # if ACE_SIZEOF_LONG == 8
01004 ACE_BITS_PER_WORD = 64,
01005 # elif ACE_SIZEOF_LONG == 4
01006 ACE_BITS_PER_WORD = 32,
01007 # else
01008 # error ACE_TSS_Keys only supports 32 or 64 bit longs.
01009 # endif /* ACE_SIZEOF_LONG == 8 */
01010 ACE_WORDS = (ACE_DEFAULT_THREAD_KEYS - 1) / ACE_BITS_PER_WORD + 1
01011 };
|
|
|
Default constructor, to initialize all bits to zero (unused).
Definition at line 466 of file OS_NS_Thread.cpp. References ACE_WORDS, and key_bit_words_.
00467 {
00468 for (u_int i = 0; i < ACE_WORDS; ++i)
00469 {
00470 key_bit_words_[i] = 0;
00471 }
00472 }
|
|
||||||||||||||||
|
For a given key, find the word and bit number that represent it.
Definition at line 476 of file OS_NS_Thread.cpp. Referenced by is_set(), test_and_clear(), and test_and_set().
00477 {
00478 word = key / ACE_BITS_PER_WORD;
00479 bit = key % ACE_BITS_PER_WORD;
00480 }
|
|
|
Return whether the specific key is marked as in use. Returns 1 if the key is been marked, 0 if not. Definition at line 519 of file OS_NS_Thread.cpp. References ACE_BIT_ENABLED, ACE_KEY_INDEX, ACE_thread_key_t, ACE_WORDS, find(), and key_bit_words_.
00520 {
00521 ACE_KEY_INDEX (key_index, key);
00522 u_int word, bit;
00523 find (key_index, word, bit);
00524
00525 return word < ACE_WORDS ? ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit) : 0;
00526 }
|
|
|
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 501 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().
00502 {
00503 ACE_KEY_INDEX (key_index, key);
00504 u_int word, bit;
00505 find (key_index, word, bit);
00506
00507 if (word < ACE_WORDS && ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit))
00508 {
00509 ACE_CLR_BITS (key_bit_words_[word], 1 << bit);
00510 return 0;
00511 }
00512 else
00513 {
00514 return 1;
00515 }
00516 }
|
|
|
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 483 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().
00484 {
00485 ACE_KEY_INDEX (key_index, key);
00486 u_int word, bit;
00487 find (key_index, word, bit);
00488
00489 if (ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit))
00490 {
00491 return 1;
00492 }
00493 else
00494 {
00495 ACE_SET_BITS (key_bit_words_[word], 1 << bit);
00496 return 0;
00497 }
00498 }
|
|
|
Bit flag collection. A bit value of 1 indicates that the key is in use by this thread. Definition at line 1015 of file OS_NS_Thread.h. Referenced by ACE_TSS_Keys(), is_set(), test_and_clear(), and test_and_set(). |
1.3.6