> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/thread_8h_source.md).

# thread.h

[Go to the documentation of this file.](/adk-5.0-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/thread_8h.md)

```cpp
 1 #ifndef THREAD_H
 2 #define THREAD_H
 3 
 4 #include <pthread.h>
 5 
 6 class Thread
 7 {
 8  friend class ThreadControl;
 9 
 10  // disable copy constructor and assign operator
 11  Thread(const Thread&);
 12  Thread& operator=(const Thread&);
 13 #if __cplusplus >= 201103L // since C++11 also forbid usage of move
 14  Thread(const Thread&&);
 15  Thread& operator=(Thread&&);
 16 #endif
 17 
 18  public:
 19  Thread() {};
 20  virtual ~Thread() {};
 21 
 22  protected:
 23  virtual void *main() = 0;
 24  virtual void thread_init() {};
 25 };
 26 
 27 
 28 class ThreadControl
 29 {
 30  private:
 31 
 32  // disable copy constructor and assign operator
 33  ThreadControl(const ThreadControl&);
 34  ThreadControl& operator=(const ThreadControl&);
 35 #if __cplusplus >= 201103L // since C++11 also forbid usage of move
 36  ThreadControl(const ThreadControl&&);
 37  ThreadControl& operator=(ThreadControl&&);
 38 #endif
 39 
 40  static void *main(void *arg);
 41 
 42  pthread_t pthread;
 43 
 44  public:
 45 
 46  enum ThreadState { Initialized, Running, Stopped, Detached } threadState;
 47 
 48  ThreadControl(Thread *o, int detach = 0);
 49  virtual ~ThreadControl()
 50  {
 51  wait();
 52  }
 53 
 54  void *wait();
 55  ThreadState getState() const
 56  {
 57  return threadState;
 58  }
 59 };
 60 
 61 #endif
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/thread_8h_source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
