---
name: "ACE_TSS_Keys"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_TSS_Keys"
---

# ACE\_TSS\_Keys(3)

Collection of in-use flags for a thread's TSS keys. For internal use only by ACE\_TSS\_Cleanup; it is public because some compilers can't use nested classes for template instantiation parameters.

## NAME

ACE\_TSS\_Keys -  Collection of in-use flags for a thread's TSS keys. For internal use only by ACE\_TSS\_Cleanup; it is public because some compilers can't use nested classes for template instantiation parameters.

## SYNOPSIS

```
#include <ace/OS.h>
class ACE_TSS_Keys
{
  public:
    ACE_TSS_Keys (void);
    int test_and_set (const ACE_thread_key_t key);
    int test_and_clear (const ACE_thread_key_t key);
  private:
    static void find (const u_int key, u_int &word, u_int &bit);
    enum{ # if ACE_SIZEOF_LONG == 8 ACE_BITS_PER_WORD = 64, # elif ACE_SIZEOF_LONG == 4 ACE_BITS_PER_WORD = 32, # else # error ACE_TSS_Keys only supports 32 or 64 bit longs. # endif ACE_WORDS = (
        ACE_DEFAULT_THREAD_KEYS - 1) / ACE_BITS_PER_WORD + 1 };

    u_long key_bit_words_[ACE_WORDS];
};
```

## DESCRIPTION

Wrapper around array of whether each key is in use.  A simple typedef doesn't work with Sun C++ 4.2.

## PUBLIC MEMBERS

```
ACE_TSS_Keys (void);
```

Default constructor, to initialize all bits to zero (unused).

```
int test_and_set (const ACE_thread_key_t key);
```

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.

```
int test_and_clear (const ACE_thread_key_t key);
```

Mark the specified key as not being in use, if it was not already so cleared.  Returns 1 if the had already been cleared, 0 if not.

## PRIVATE MEMBERS

```
static 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.

```
u_long key_bit_words_[ACE_WORDS];
```

Bit flag collection.  A bit value of 1 indicates that the key is in use by this thread.

## AUTHOR

Doug Schmidt schmidt@cs.wustl.edu, Jesper S. M\|ller stophph@diku.dk, and a cast of thousands...

## The ACE\_Sched\_Priority type should be used for platform-

independent thread and process priorities, by convention. int should be used for OS-specific priorities.

## typedef for the \_stat data structure

## Giving unique ACE scoped names for some important

RTSignal-Related constants. Becuase sometimes, different platforms use different names for these constants.

## LIBRARY

ace
