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

Last change on this file since 21956 was 21956, checked in by dmik, 14 years ago

Implement SwitchToThread() API.

This is in particular referenced by Flash 10.3 and above.

File size: 3.4 KB
Line 
1/* $Id: async.cpp,v 1.11 2001-12-05 14:15:56 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 */
20
21
22
23/*****************************************************************************
24 * Includes *
25 *****************************************************************************/
26
27#define INCL_WIN
28#define INCL_DOSMEMMGR
29#define INCL_DOSSEMAPHORES
30#define INCL_DOSERRORS
31#define INCL_DOSPROCESS
32#define INCL_DOSMODULEMGR
33#define INCL_VIO
34#define INCL_AVIO
35#include <os2wrap.h> //Odin32 OS/2 api wrappers
36
37#include <stdlib.h>
38#include <string.h>
39#include "win32type.h"
40#include "misc.h"
41#include "unicode.h"
42
43#include "conwin.h" // Windows Header for console only
44#include "handlemanager.h"
45
46#define DBG_LOCALLOG DBG_async
47#include "dbglocal.h"
48
49
50/*****************************************************************************
51 * Defines & Macros *
52 *****************************************************************************/
53
54
55/*****************************************************************************
56 * Structures *
57 *****************************************************************************/
58
59typedef struct _IORequest
60{
61 struct _IORequest *pNext; /* pointer to next I/O request */
62
63 APIRET rc; /* result code of I/O request */
64
65} IOREQUEST, *PIOREQUEST;
66
67
68typedef struct _Globals
69{
70 HEV hevIOEvent; /* asynchronous I/O event completed ! */
71 TID tidIO; /* I/O thread */
72} GLOBALS, *PGLOBALS;
73
74static GLOBALS Globals;
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 *****************************************************************************/
111BOOL WIN32API SwitchToThread(void)
112{
113 // It's not clear from CPREF, if DosSleep(1) can allow a switch to another
114 // CPU, so there is no guarantee of the 100% functional equality
115 dprintf(("SwitchToThread: not fully supported!"));
116 APIRET rc = DosSleep(1);
117 return rc == NO_ERROR;
118}
Note: See TracBrowser for help on using the repository browser.