1 | /* $Id: threads.h 18 2001-01-01 15:30:29Z umoeller $ */
|
---|
2 |
|
---|
3 |
|
---|
4 | /*
|
---|
5 | *@@sourcefile threads.h:
|
---|
6 | * header file for treads.c. See remarks there.
|
---|
7 | *
|
---|
8 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
9 | * numbering.
|
---|
10 | *
|
---|
11 | *@@include #define INCL_DOSPROCESS
|
---|
12 | *@@include #include <os2.h>
|
---|
13 | *@@include #include "threads.h"
|
---|
14 | */
|
---|
15 |
|
---|
16 | /*
|
---|
17 | * Copyright (C) 1997-2000 Ulrich Mller.
|
---|
18 | * This file is part of the "XWorkplace helpers" source package.
|
---|
19 | * This is free software; you can redistribute it and/or modify
|
---|
20 | * it under the terms of the GNU General Public License as published
|
---|
21 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
22 | * "COPYING" file of the XWorkplace main distribution.
|
---|
23 | * This program is distributed in the hope that it will be useful,
|
---|
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
26 | * GNU General Public License for more details.
|
---|
27 | */
|
---|
28 |
|
---|
29 | #if __cplusplus
|
---|
30 | extern "C" {
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #ifndef THREADS_HEADER_INCLUDED
|
---|
34 | #define THREADS_HEADER_INCLUDED
|
---|
35 |
|
---|
36 | #define THRF_PMMSGQUEUE 0x0001
|
---|
37 | #define THRF_WAIT 0x0002
|
---|
38 | #define THRF_TRANSIENT 0x0004
|
---|
39 |
|
---|
40 | /*
|
---|
41 | *@@ THREADINFO:
|
---|
42 | * thread info structure passed to secondary threads.
|
---|
43 | */
|
---|
44 |
|
---|
45 | typedef struct _THREADINFO
|
---|
46 | {
|
---|
47 | // data maintained by thr* functions
|
---|
48 | ULONG cbStruct;
|
---|
49 | void* pThreadFunc; // as passed to thrCreate, really a PTHREADFUNC
|
---|
50 | PBOOL pfRunning; // as passed to thrCreate
|
---|
51 | ULONG flFlags; // as passed to thrCreate
|
---|
52 | ULONG ulData; // as passed to thrCreate
|
---|
53 |
|
---|
54 | TID tid;
|
---|
55 | ULONG hevRunning; // this is a HEV really
|
---|
56 |
|
---|
57 | // data maintained by thr_fntGeneric
|
---|
58 | HAB hab; // for PM threads
|
---|
59 | HMQ hmq; // for PM threads
|
---|
60 | BOOL fExitComplete; // TRUE if thr_fntGeneric is exiting
|
---|
61 |
|
---|
62 | // data to be maintained by application
|
---|
63 | BOOL fExit;
|
---|
64 | ULONG ulResult;
|
---|
65 | ULONG ulFuncInfo;
|
---|
66 | HWND hwndNotify;
|
---|
67 | } THREADINFO, *PTHREADINFO;
|
---|
68 |
|
---|
69 | typedef void _Optlink THREADFUNC (PTHREADINFO);
|
---|
70 | typedef THREADFUNC *PTHREADFUNC;
|
---|
71 |
|
---|
72 | BOOL thrCreate(PTHREADINFO pti,
|
---|
73 | PTHREADFUNC pfn,
|
---|
74 | PBOOL pfRunning,
|
---|
75 | ULONG flFlags,
|
---|
76 | ULONG ulData);
|
---|
77 |
|
---|
78 | ULONG thrRunSync(HAB hab,
|
---|
79 | PTHREADFUNC pfn,
|
---|
80 | ULONG ulData);
|
---|
81 |
|
---|
82 | BOOL thrClose(PTHREADINFO pti);
|
---|
83 |
|
---|
84 | BOOL thrWait(PTHREADINFO pti);
|
---|
85 |
|
---|
86 | BOOL thrFree(PTHREADINFO pti);
|
---|
87 |
|
---|
88 | BOOL thrKill(PTHREADINFO pti);
|
---|
89 |
|
---|
90 | TID thrQueryID(const THREADINFO* pti);
|
---|
91 |
|
---|
92 | ULONG thrQueryPriority(VOID);
|
---|
93 |
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | #if __cplusplus
|
---|
97 | }
|
---|
98 | #endif
|
---|
99 |
|
---|