1 | /* $Id: async.cpp,v 1.10 2001-03-13 18:45:32 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 Asynchronous I/O Subsystem for OS/2
|
---|
5 | *
|
---|
6 | * 1998/04/10 PH Patrick Haller (haller@zebra.fh-weingarten.de)
|
---|
7 | *
|
---|
8 | * @(#) Async.Cpp 1.0.0 1998/04/10 PH start
|
---|
9 | *
|
---|
10 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
11 | *
|
---|
12 | */
|
---|
13 |
|
---|
14 |
|
---|
15 | /*****************************************************************************
|
---|
16 | * Remark *
|
---|
17 | *****************************************************************************
|
---|
18 |
|
---|
19 | ReadFileEx
|
---|
20 |
|
---|
21 | */
|
---|
22 |
|
---|
23 |
|
---|
24 |
|
---|
25 | /*****************************************************************************
|
---|
26 | * Includes *
|
---|
27 | *****************************************************************************/
|
---|
28 |
|
---|
29 | #define INCL_WIN
|
---|
30 | #define INCL_DOSMEMMGR
|
---|
31 | #define INCL_DOSSEMAPHORES
|
---|
32 | #define INCL_DOSERRORS
|
---|
33 | #define INCL_DOSPROCESS
|
---|
34 | #define INCL_DOSMODULEMGR
|
---|
35 | #define INCL_VIO
|
---|
36 | #define INCL_AVIO
|
---|
37 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
38 |
|
---|
39 | #include <stdlib.h>
|
---|
40 | #include <string.h>
|
---|
41 | #include "win32type.h"
|
---|
42 | #include "misc.h"
|
---|
43 | #include "unicode.h"
|
---|
44 |
|
---|
45 | #include "conwin.h" // Windows Header for console only
|
---|
46 | #include "handlemanager.h"
|
---|
47 |
|
---|
48 | #define DBG_LOCALLOG DBG_async
|
---|
49 | #include "dbglocal.h"
|
---|
50 |
|
---|
51 |
|
---|
52 | /*****************************************************************************
|
---|
53 | * Defines & Macros *
|
---|
54 | *****************************************************************************/
|
---|
55 |
|
---|
56 |
|
---|
57 | /*****************************************************************************
|
---|
58 | * Structures *
|
---|
59 | *****************************************************************************/
|
---|
60 |
|
---|
61 | typedef struct _IORequest
|
---|
62 | {
|
---|
63 | struct _IORequest *pNext; /* pointer to next I/O request */
|
---|
64 |
|
---|
65 | APIRET rc; /* result code of I/O request */
|
---|
66 |
|
---|
67 | } IOREQUEST, *PIOREQUEST;
|
---|
68 |
|
---|
69 |
|
---|
70 | typedef struct _Globals
|
---|
71 | {
|
---|
72 | HEV hevIOEvent; /* asynchronous I/O event completed ! */
|
---|
73 | TID tidIO; /* I/O thread */
|
---|
74 | } GLOBALS, *PGLOBALS;
|
---|
75 |
|
---|
76 | static GLOBALS Globals;
|
---|
77 |
|
---|
78 |
|
---|
79 | /*****************************************************************************
|
---|
80 | * Name :
|
---|
81 | * Purpose :
|
---|
82 | * Parameters:
|
---|
83 | * Variables :
|
---|
84 | * Result :
|
---|
85 | * Remark :
|
---|
86 | * Status :
|
---|
87 | *
|
---|
88 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
---|
89 | *****************************************************************************/
|
---|
90 |
|
---|
91 | DWORD WIN32API SleepEx(DWORD dwTimeout,
|
---|
92 | BOOL fAlertable)
|
---|
93 | {
|
---|
94 |
|
---|
95 | dprintf(("KERNEL32: SleepEx(%u,%u)\n",
|
---|
96 | dwTimeout,
|
---|
97 | fAlertable));
|
---|
98 |
|
---|
99 | /* @@@PH could be implemented as a timed wait on a event semaphore */
|
---|
100 | /* for the WAIT_IO_COMPLETION flag */
|
---|
101 |
|
---|
102 | if (fAlertable == FALSE)
|
---|
103 | DosSleep(dwTimeout);
|
---|
104 | else {
|
---|
105 | dprintf(("SleepEx: Wait for io completion not supported!"));
|
---|
106 | DosSleep(1);
|
---|
107 | }
|
---|
108 |
|
---|
109 | return (0);
|
---|
110 | }
|
---|
111 |
|
---|