---
name: "TAU_REGISTER_THREAD"
section: "3"
platform: "linux"
package: "tau"
version: "2.17.3.1.dfsg-4.2"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/TAU_REGISTER_THREAD"
---

# TAU\_REGISTER\_THREAD(3)

Register a thread with the profiling system

## NAME

TAU\_REGISTER\_THREAD - Register a thread with the profiling system

## SYNOPSIS

**C/C++:**

**TAU\_REGISTER\_THREAD(void);**

**Fortran:**

**TAU\_REGISTER\_THREAD(void);**

## DESCRIPTION

To register a thread with the profiling system, invoke the TAU\_REGISTER\_THREAD macro in the run method of the thread prior to executing any other TAU macro. This sets up thread identifiers that are later used by the instrumentation system.

## EXAMPLE

**C/C++ :**

```
void * threaded_func(void *data) {
  TAU_REGISTER_THREAD();
  { /**** NOTE WE START ANOTHER BLOCK IN THREAD */
    TAU_PROFILE_TIMER(tautimer, "threaded_func()", "int ()",
                      TAU_DEFAULT);
    TAU_PROFILE_START(tautimer);
    work(); /* work done by this thread */
    TAU_PROFILE_STOP(tautimer);
  }
  return NULL;
}
```

**Fortran :**

```
call TAU_REGISTER_THREAD()
```

## CAVEAT

PDT based tau\_instrumentor does not insert TAU\_REGISTER\_THREAD calls, they must be inserted manually
