Home
Information
Classes
Download
Usage
Mail List
Requirements
Links
FAQ
Tutorial
include
Thread.h
1
#ifndef STK_THREAD_H
2
#define STK_THREAD_H
3
4
#include "Stk.h"
5
6
#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))
7
8
#include <pthread.h>
9
#define THREAD_TYPE
10
typedef
pthread_t THREAD_HANDLE;
11
typedef
void
* THREAD_RETURN;
12
typedef
void
* (*THREAD_FUNCTION)(
void
*);
13
14
#elif defined(__OS_WINDOWS__)
15
16
#include <windows.h>
17
#include <process.h>
18
#define THREAD_TYPE __stdcall
19
typedef
unsigned
long
THREAD_HANDLE;
20
typedef
unsigned
THREAD_RETURN;
21
typedef
unsigned (__stdcall *THREAD_FUNCTION)(
void
*);
22
23
#endif
24
25
namespace
stk {
26
27
/***************************************************/
47
/***************************************************/
48
49
class
Thread
:
public
Stk
50
{
51
public
:
53
Thread
();
54
56
~Thread
();
57
59
64
bool
start
( THREAD_FUNCTION routine,
void
* ptr = NULL );
65
67
74
bool
cancel
(
void
);
75
77
80
bool
wait
(
void
);
81
83
88
void
testCancel
(
void
);
89
90
protected
:
91
92
THREAD_HANDLE thread_;
93
94
};
95
96
}
// stk namespace
97
98
#endif
The Synthesis ToolKit in C++ (STK)
©1995--2014 Perry R. Cook and Gary P. Scavone. All Rights Reserved.