| Line |  | 
|---|
| 1 | /* $Id: asyncthread.h,v 1.2 2000-03-23 19:21:54 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Async thread help functions | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 2000 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 7 | * | 
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 9 | */ | 
|---|
| 10 | #ifndef __ASYNCTHREAD_H__ | 
|---|
| 11 | #define __ASYNCTHREAD_H__ | 
|---|
| 12 |  | 
|---|
| 13 | #include <vmutex.h> | 
|---|
| 14 | #include <vsemaphore.h> | 
|---|
| 15 |  | 
|---|
| 16 | #define ASYNCCNV        _Optlink | 
|---|
| 17 |  | 
|---|
| 18 | typedef void (* ASYNCCNV ASYNCTHREADPROC)(void *); | 
|---|
| 19 |  | 
|---|
| 20 | enum AsyncRequestType { | 
|---|
| 21 | ASYNC_GETHOSTBYNAME, | 
|---|
| 22 | ASYNC_GETHOSTBYADDR, | 
|---|
| 23 | ASYNC_GETPROTOBYNAME, | 
|---|
| 24 | ASYNC_GETPROTOBYNUMBER, | 
|---|
| 25 | ASYNC_GETSERVBYNAME, | 
|---|
| 26 | ASYNC_GETSERVBYPORT, | 
|---|
| 27 | ASYNC_SELECT | 
|---|
| 28 | } ; | 
|---|
| 29 |  | 
|---|
| 30 | typedef struct _ASYNCTHREADPARM | 
|---|
| 31 | { | 
|---|
| 32 | BOOL            fActive; | 
|---|
| 33 | BOOL            fCancelled; | 
|---|
| 34 | AsyncRequestType request; | 
|---|
| 35 | LHANDLE         hAsyncTaskHandle; | 
|---|
| 36 | HANDLE          hThread; //handle of thread that started the async request | 
|---|
| 37 | ASYNCTHREADPROC asyncProc; | 
|---|
| 38 | VMutex         *parmmutex; | 
|---|
| 39 | HWND            hwnd; | 
|---|
| 40 | DWORD           msg; | 
|---|
| 41 | LPSTR           buf; | 
|---|
| 42 | DWORD           buflen; | 
|---|
| 43 | union { | 
|---|
| 44 | struct { | 
|---|
| 45 | LPSTR   name; | 
|---|
| 46 | } gethostbyname; | 
|---|
| 47 | struct { | 
|---|
| 48 | LPSTR   addr; | 
|---|
| 49 | int     len; | 
|---|
| 50 | int     type; | 
|---|
| 51 | } gethostbyaddr; | 
|---|
| 52 | struct { | 
|---|
| 53 | LPSTR   name; | 
|---|
| 54 | } getprotobyname; | 
|---|
| 55 | struct { | 
|---|
| 56 | int     number; | 
|---|
| 57 | } getprotobynumber; | 
|---|
| 58 | struct { | 
|---|
| 59 | LPSTR   name; | 
|---|
| 60 | LPSTR   proto; | 
|---|
| 61 | } getservbyname; | 
|---|
| 62 | struct { | 
|---|
| 63 | int     port; | 
|---|
| 64 | LPSTR   proto; | 
|---|
| 65 | } getservbyport; | 
|---|
| 66 | struct { | 
|---|
| 67 | VSemaphore *asyncSem; | 
|---|
| 68 | DWORD       lEvents; | 
|---|
| 69 | DWORD       lEventsPending; | 
|---|
| 70 | SOCKET      s; | 
|---|
| 71 | } asyncselect; | 
|---|
| 72 | } u; | 
|---|
| 73 | _ASYNCTHREADPARM *next; | 
|---|
| 74 | } ASYNCTHREADPARM, *PASYNCTHREADPARM; | 
|---|
| 75 |  | 
|---|
| 76 | ULONG QueueAsyncJob(ASYNCTHREADPROC asyncproc, PASYNCTHREADPARM pThreadParm, BOOL fSetBlocking = FALSE); | 
|---|
| 77 | void  RemoveFromQueue(PASYNCTHREADPARM pThreadParm); | 
|---|
| 78 |  | 
|---|
| 79 | void  EnableAsyncEvent(SOCKET s, ULONG flags); | 
|---|
| 80 | BOOL  QueryAsyncEvent(SOCKET s, HWND *pHwnd, int *pMsg, ULONG *plEvent); | 
|---|
| 81 | BOOL  FindAndSetAsyncEvent(SOCKET s, HWND hwnd, int msg, ULONG lEvent); | 
|---|
| 82 |  | 
|---|
| 83 | #endif  //__ASYNCTHREAD_H__ | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.