[7] | 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>
|
---|
[113] | 11 | *@@include #include "helpers\threads.h"
|
---|
[7] | 12 | */
|
---|
| 13 |
|
---|
| 14 | /*
|
---|
[86] | 15 | * Copyright (C) 1997-2001 Ulrich Mller.
|
---|
[14] | 16 | * This file is part of the "XWorkplace helpers" source package.
|
---|
| 17 | * This is free software; you can redistribute it and/or modify
|
---|
[7] | 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
|
---|
[18] | 36 | #define THRF_TRANSIENT 0x0004
|
---|
[49] | 37 | #define THRF_WAIT_EXPLICIT 0x0008 // V0.9.9 (2001-03-14) [umoeller]
|
---|
[7] | 38 |
|
---|
| 39 | /*
|
---|
| 40 | *@@ THREADINFO:
|
---|
| 41 | * thread info structure passed to secondary threads.
|
---|
[86] | 42 | * See thrCreate.
|
---|
[7] | 43 | */
|
---|
| 44 |
|
---|
| 45 | typedef struct _THREADINFO
|
---|
| 46 | {
|
---|
[86] | 47 | // data maintained by thr* functions
|
---|
| 48 | ULONG cbStruct;
|
---|
| 49 | void* pThreadFunc; // as passed to thrCreate, really a PTHREADFUNC
|
---|
[115] | 50 | volatile unsigned long *ptidRunning;
|
---|
| 51 | // as passed to thrCreate V0.9.12 (2001-05-20) [umoeller]
|
---|
[86] | 52 | const char *pcszThreadName; // as passed to thrCreate
|
---|
| 53 | ULONG flFlags; // as passed to thrCreate
|
---|
| 54 | ULONG ulData; // as passed to thrCreate
|
---|
[7] | 55 |
|
---|
[86] | 56 | TID tid;
|
---|
| 57 | ULONG hevRunning; // this is a HEV really
|
---|
[7] | 58 |
|
---|
[86] | 59 | // data maintained by thr_fntGeneric
|
---|
| 60 | HAB hab; // for PM threads
|
---|
| 61 | HMQ hmq; // for PM threads
|
---|
[123] | 62 | HEV hevExitComplete; // posted when thread exits V0.9.16 (2001-12-08) [umoeller]
|
---|
[7] | 63 |
|
---|
[86] | 64 | // data to be maintained by application
|
---|
| 65 | BOOL fExit;
|
---|
| 66 | ULONG ulResult;
|
---|
| 67 | ULONG ulFuncInfo;
|
---|
| 68 | HWND hwndNotify;
|
---|
[7] | 69 | } THREADINFO, *PTHREADINFO;
|
---|
| 70 |
|
---|
| 71 | typedef void _Optlink THREADFUNC (PTHREADINFO);
|
---|
| 72 | typedef THREADFUNC *PTHREADFUNC;
|
---|
| 73 |
|
---|
[86] | 74 | ULONG XWPENTRY thrCreate(PTHREADINFO pti,
|
---|
| 75 | PTHREADFUNC pfn,
|
---|
[115] | 76 | volatile unsigned long *ptidRunning,
|
---|
[86] | 77 | const char *pcszThreadName,
|
---|
| 78 | ULONG flFlags,
|
---|
| 79 | ULONG ulData);
|
---|
| 80 | // this function is exported, so add definition here V0.9.13 (2001-06-13) [lafaix]
|
---|
| 81 | typedef BOOL XWPENTRY THRCREATE(PTHREADINFO, PTHREADFUNC, PULONG, const char *, ULONG, ULONG);
|
---|
| 82 | typedef THRCREATE *PTHRCREATE;
|
---|
[7] | 83 |
|
---|
[86] | 84 | ULONG XWPENTRY thrRunSync(HAB hab,
|
---|
| 85 | PTHREADFUNC pfn,
|
---|
| 86 | const char *pcszThreadName,
|
---|
| 87 | ULONG ulData);
|
---|
[7] | 88 |
|
---|
[86] | 89 | PTHREADINFO XWPENTRY thrListThreads(PULONG pcThreads);
|
---|
[44] | 90 |
|
---|
[86] | 91 | BOOL XWPENTRY thrFindThread(PTHREADINFO pti,
|
---|
| 92 | ULONG tid);
|
---|
[44] | 93 |
|
---|
[86] | 94 | BOOL XWPENTRY thrClose(PTHREADINFO pti);
|
---|
[7] | 95 |
|
---|
[86] | 96 | BOOL XWPENTRY thrWait(PTHREADINFO pti);
|
---|
[7] | 97 |
|
---|
[86] | 98 | BOOL XWPENTRY thrFree(PTHREADINFO pti);
|
---|
[7] | 99 |
|
---|
[86] | 100 | BOOL XWPENTRY thrKill(PTHREADINFO pti);
|
---|
[7] | 101 |
|
---|
[86] | 102 | TID XWPENTRY thrQueryID(const THREADINFO* pti);
|
---|
[7] | 103 |
|
---|
[86] | 104 | ULONG XWPENTRY thrQueryPriority(VOID);
|
---|
[7] | 105 |
|
---|
| 106 | #endif
|
---|
| 107 |
|
---|
| 108 | #if __cplusplus
|
---|
| 109 | }
|
---|
| 110 | #endif
|
---|
| 111 |
|
---|