---
name: "ACE_Thread_Control"
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_Thread_Control"
---

# ACE\_Thread\_Control(3)

Used to keep track of a thread's activities within its entry point function.

## NAME

ACE\_Thread\_Control -  Used to keep track of a thread's activities within its entry point function.

## SYNOPSIS

```
#include <ace/OS.h>
class ACE_Thread_Control
{
  public:
    ACE_Thread_Control (ACE_Thread_Manager *tm = 0, int insert = 0);
    ~ACE_Thread_Control (void);
    void *exit (void *status, int do_thr_exit);
    int insert (ACE_Thread_Manager *tm, int insert = 0);
    ACE_Thread_Manager *thr_mgr (void);
    ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *);
    void *status (void *status);
    void *status (void);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  private:
    ACE_Thread_Manager *tm_;
    void *status_;
};
```

## DESCRIPTION

A ACE\_Thread\_Manager uses this class to ensure that threads it spawns automatically register and unregister themselves with it.

This class can be stored in thread-specific storage using the ACE\_TSS wrapper.  When a thread exits the ACE\_TSS::cleanup function deletes this object, thereby ensuring that it gets removed from its associated ACE\_Thread\_Manager.

## PUBLIC MEMBERS

```
ACE_Thread_Control (ACE_Thread_Manager *tm = 0, int insert = 0);
```

Initialize the thread control object.  If insert != 0, then register the thread with the Thread\_Manager.

```
~ACE_Thread_Control (void);
```

Remove the thread from its associated Thread\_Manager and exit the thread if do\_thr\_exit is enabled.

```
void *exit (void *status, int do_thr_exit);
```

Remove this thread from its associated Thread\_Manager and exit the thread if do\_thr\_exit is enabled.

```
int insert (ACE_Thread_Manager *tm, int insert = 0);
```

Store the Thread\_Manager and use it to register ourselves for correct shutdown.

```
ACE_Thread_Manager *thr_mgr (void);
```

Returns the current Thread\_Manager.

```
ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *);
```

Atomically set a new Thread\_Manager and return the old Thread\_Manager.

```
void *status (void *status);
```

Set the exit status (and return existing status).

```
void *status (void);
```

Get the current exit status.

```
void dump (void) const;
```

Dump the state of an object.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

## PRIVATE MEMBERS

```
ACE_Thread_Manager *tm_;
```

Pointer to the thread manager for this block of code.

```
void *status_;
```

Keeps track of the exit status for the 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
