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