source: trunk/src/kernel32/async.cpp@ 46

Last change on this file since 46 was 46, checked in by sandervl, 26 years ago

* empty log message *

File size: 6.4 KB
Line 
1/*
2 * Win32 Asynchronous I/O Subsystem for OS/2
3 *
4 * 1998/04/10 PH Patrick Haller (haller@zebra.fh-weingarten.de)
5 *
6 * @(#) Async.Cpp 1.0.0 1998/04/10 PH start
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11
12#ifndef _ASYNCIOSUBSYSTEM_H_
13#define _ASYNCIOSUBSYSTEM_H_
14
15
16/*****************************************************************************
17 * Remark *
18 *****************************************************************************
19
20 ReadFileEx
21
22 */
23
24
25
26/*****************************************************************************
27 * Includes *
28 *****************************************************************************/
29
30#define INCL_WIN
31#define INCL_DOSMEMMGR
32#define INCL_DOSSEMAPHORES
33#define INCL_DOSERRORS
34#define INCL_DOSPROCESS
35#define INCL_DOSMODULEMGR
36#define INCL_VIO
37#define INCL_AVIO
38#include <os2.h>
39#include <builtin.h>
40
41#include <stdlib.h>
42#include <string.h>
43#include "win32type.h"
44#include "misc.h"
45#include "unicode.h"
46#include "handlemanager.h"
47
48
49/*****************************************************************************
50 * Defines & Macros *
51 *****************************************************************************/
52
53
54/*****************************************************************************
55 * Structures *
56 *****************************************************************************/
57
58typedef struct _IORequest
59{
60 struct _IORequest *pNext; /* pointer to next I/O request */
61
62 APIRET rc; /* result code of I/O request */
63
64} IOREQUEST, *PIOREQUEST;
65
66
67typedef struct _Globals
68{
69 HEV hevIOEvent; /* asynchronous I/O event completed ! */
70 TID tidIO; /* I/O thread */
71} GLOBALS, *PGLOBALS;
72
73static GLOBALS Globals;
74
75
76/*****************************************************************************
77 * Name :
78 * Purpose :
79 * Parameters:
80 * Variables :
81 * Result :
82 * Remark :
83 * Status :
84 *
85 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
86 *****************************************************************************/
87
88DWORD WIN32API SleepEx(DWORD dwTimeout,
89 BOOL fAlertable)
90{
91
92 dprintf(("KERNEL32: SleepEx(%u,%u)\n",
93 dwTimeout,
94 fAlertable));
95
96 /* @@@PH could be implemented as a timed wait on a event semaphore */
97 /* for the WAIT_IO_COMPLETION flag */
98
99 if (fAlertable == FALSE)
100 DosSleep(dwTimeout);
101 else {
102 dprintf(("SleepEx: Wait for io completion not supported!"));
103 DosSleep(1);
104 }
105
106 return (0);
107}
108
109
110/*****************************************************************************
111 * Name : BOOL ReadFileEx
112 * Purpose : The ReadFileEx function reads data from a file asynchronously.
113 * It is designed solely for asynchronous operation, unlike the
114 * ReadFile function, which is designed for both synchronous and
115 * asynchronous operation. ReadFileEx lets an application perform
116 * other processing during a file read operation.
117 * The ReadFileEx function reports its completion status asynchronously,
118 * calling a specified completion routine when reading is completed
119 * and the calling thread is in an alertable wait state.
120 * Parameters: HANDLE hFile handle of file to read
121 * LPVOID lpBuffer address of buffer
122 * DWORD nNumberOfBytesToRead number of bytes to read
123 * LPOVERLAPPED lpOverlapped address of offset
124 * LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine address of completion routine
125 * Variables :
126 * Result : TRUE / FALSE
127 * Remark :
128 * Status : UNTESTED STUB
129 *
130 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
131 *****************************************************************************/
132
133#define LPOVERLAPPED_COMPLETION_ROUTINE LPVOID
134
135DWORD WIN32API ReadFileEx(HANDLE hFile,
136 LPVOID lpBuffer,
137 DWORD nNumberOfBytesToRead,
138 LPOVERLAPPED lpOverlapped,
139 LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
140{
141 dprintf(("Kernel32: ReadFileEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
142 hFile,
143 lpBuffer,
144 nNumberOfBytesToRead,
145 lpOverlapped,
146 lpCompletionRoutine));
147
148
149 return (FALSE);
150}
151
152
153/*****************************************************************************
154 * Name : BOOL WriteFileEx
155 * Purpose : The WriteFileEx function writes data to a file. It is designed
156 * solely for asynchronous operation, unlike WriteFile, which is
157 * designed for both synchronous and asynchronous operation.
158 * WriteFileEx reports its completion status asynchronously,
159 * calling a specified completion routine when writing is completed
160 * and the calling thread is in an alertable wait state.
161 * Parameters: HANDLE hFile handle of file to write
162 * LPVOID lpBuffer address of buffer
163 * DWORD nNumberOfBytesToRead number of bytes to write
164 * LPOVERLAPPED lpOverlapped address of offset
165 * LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine address of completion routine
166 * Variables :
167 * Result : TRUE / FALSE
168 * Remark :
169 * Status : UNTESTED STUB
170 *
171 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
172 *****************************************************************************/
173
174DWORD WIN32API WriteFileEx(HANDLE hFile,
175 LPVOID lpBuffer,
176 DWORD nNumberOfBytesToWrite,
177 LPOVERLAPPED lpOverlapped,
178 LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
179{
180 dprintf(("Kernel32: WriteFileEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
181 hFile,
182 lpBuffer,
183 nNumberOfBytesToWrite,
184 lpOverlapped,
185 lpCompletionRoutine));
186
187
188 return (FALSE);
189}
190
191
192#endif /* _ASYNCIOSUBSYSTEM_H_ */
Note: See TracBrowser for help on using the repository browser.