1 |
|
---|
2 | /*
|
---|
3 | *@@sourcefile threads.h:
|
---|
4 | * header file for treads.c. See remarks there.
|
---|
5 | *
|
---|
6 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
7 | * numbering.
|
---|
8 | *
|
---|
9 | *@@include #define INCL_DOSPROCESS
|
---|
10 | *@@include #include <os2.h>
|
---|
11 | *@@include #include "helpers\threads.h"
|
---|
12 | */
|
---|
13 |
|
---|
14 | /*
|
---|
15 | * Copyright (C) 1997-2001 Ulrich Mller.
|
---|
16 | * This file is part of the "XWorkplace helpers" source package.
|
---|
17 | * This is free software; you can redistribute it and/or modify
|
---|
18 | * it under the terms of the GNU General Public License as published
|
---|
19 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
20 | * "COPYING" file of the XWorkplace main distribution.
|
---|
21 | * This program is distributed in the hope that it will be useful,
|
---|
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
24 | * GNU General Public License for more details.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #if __cplusplus
|
---|
28 | extern "C" {
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #ifndef THREADS_HEADER_INCLUDED
|
---|
32 | #define THREADS_HEADER_INCLUDED
|
---|
33 |
|
---|
34 | #define THRF_PMMSGQUEUE 0x0001
|
---|
35 | #define THRF_WAIT 0x0002
|
---|
36 | #define THRF_TRANSIENT 0x0004
|
---|
37 | #define THRF_WAIT_EXPLICIT 0x0008 // V0.9.9 (2001-03-14) [umoeller]
|
---|
38 |
|
---|
39 | /*
|
---|
40 | *@@ THREADINFO:
|
---|
41 | * thread info structure passed to secondary threads.
|
---|
42 | * See thrCreate.
|
---|
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 | PULONG ptidRunning; // as passed to thrCreate V0.9.12 (2001-05-20) [umoeller]
|
---|
51 | const char *pcszThreadName; // as passed to thrCreate
|
---|
52 | ULONG flFlags; // as passed to thrCreate
|
---|
53 | ULONG ulData; // as passed to thrCreate
|
---|
54 |
|
---|
55 | TID tid;
|
---|
56 | ULONG hevRunning; // this is a HEV really
|
---|
57 |
|
---|
58 | // data maintained by thr_fntGeneric
|
---|
59 | HAB hab; // for PM threads
|
---|
60 | HMQ hmq; // for PM threads
|
---|
61 | BOOL fExitComplete;
|
---|
62 |
|
---|
63 | // data to be maintained by application
|
---|
64 | BOOL fExit;
|
---|
65 | ULONG ulResult;
|
---|
66 | ULONG ulFuncInfo;
|
---|
67 | HWND hwndNotify;
|
---|
68 | } THREADINFO, *PTHREADINFO;
|
---|
69 |
|
---|
70 | typedef void _Optlink THREADFUNC (PTHREADINFO);
|
---|
71 | typedef THREADFUNC *PTHREADFUNC;
|
---|
72 |
|
---|
73 | ULONG XWPENTRY thrCreate(PTHREADINFO pti,
|
---|
74 | PTHREADFUNC pfn,
|
---|
75 | PULONG pfRunning,
|
---|
76 | const char *pcszThreadName,
|
---|
77 | ULONG flFlags,
|
---|
78 | ULONG ulData);
|
---|
79 | // this function is exported, so add definition here V0.9.13 (2001-06-13) [lafaix]
|
---|
80 | typedef BOOL XWPENTRY THRCREATE(PTHREADINFO, PTHREADFUNC, PULONG, const char *, ULONG, ULONG);
|
---|
81 | typedef THRCREATE *PTHRCREATE;
|
---|
82 |
|
---|
83 | ULONG XWPENTRY thrRunSync(HAB hab,
|
---|
84 | PTHREADFUNC pfn,
|
---|
85 | const char *pcszThreadName,
|
---|
86 | ULONG ulData);
|
---|
87 |
|
---|
88 | PTHREADINFO XWPENTRY thrListThreads(PULONG pcThreads);
|
---|
89 |
|
---|
90 | BOOL XWPENTRY thrFindThread(PTHREADINFO pti,
|
---|
91 | ULONG tid);
|
---|
92 |
|
---|
93 | BOOL XWPENTRY thrClose(PTHREADINFO pti);
|
---|
94 |
|
---|
95 | BOOL XWPENTRY thrWait(PTHREADINFO pti);
|
---|
96 |
|
---|
97 | BOOL XWPENTRY thrFree(PTHREADINFO pti);
|
---|
98 |
|
---|
99 | BOOL XWPENTRY thrKill(PTHREADINFO pti);
|
---|
100 |
|
---|
101 | TID XWPENTRY thrQueryID(const THREADINFO* pti);
|
---|
102 |
|
---|
103 | ULONG XWPENTRY thrQueryPriority(VOID);
|
---|
104 |
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | #if __cplusplus
|
---|
108 | }
|
---|
109 | #endif
|
---|
110 |
|
---|