Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Mspthrd.h
Package: SwordOnline.rar [view]
Upload User: dzyhzl
Upload Date: 2019-04-29
Package Size: 56270k
Code Size: 3k
Category:
Game Server Simulator
Development Platform:
C/C++
- /*++
- Copyright (c) Microsoft Corporation. All rights reserved.
- Module Name:
- mspthrd.h
- Abstract:
- Definitions for MSP thread management classes.
- --*/
- #ifndef __MSPTHRD_H
- #define __MSPTHRD_H
- //
- // Commands that the worker worker thread can handle.
- //
- typedef enum
- {
- WORK_ITEM, // process a work item
- STOP, // kill the worker thread.
- } COMMAND;
- typedef struct
- {
- COMMAND cmd;
- LPTHREAD_START_ROUTINE pfn;
- PVOID pContext;
- HANDLE hEvent;
- } COMMAND_NODE;
- typedef struct
- {
- LIST_ENTRY link;
- COMMAND_NODE node;
- } COMMAND_QUEUE_ITEM;
- typedef struct _NOTIF_LIST
- {
- CMSPAddress *addr;
- _NOTIF_LIST *next;
- } NOTIF_LIST, *PNOTIF_LIST;
- class CMSPThread
- {
- public:
- CMSPThread()
- {
- InitializeListHead(&m_CommandQueue);
- m_hCommandEvent = NULL;
- m_hThread = NULL;
- m_NotifList = NULL;
- m_iStartCount = 0;
- }
- ~CMSPThread() { };
- HRESULT Start();
- HRESULT Stop();
- // Shutdown is used to clean up the thread unconditionally. This can be
- // used as an alternative to matched Start() / Stop() calls.
- HRESULT Shutdown();
- HRESULT ThreadProc();
- static LRESULT CALLBACK NotifWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- HRESULT RegisterPnpNotification(CMSPAddress *pCMSPAddress);
- HRESULT UnregisterPnpNotification(CMSPAddress *pCMSPAddress);
- HRESULT QueueWorkItem(
- LPTHREAD_START_ROUTINE Function,
- PVOID Context,
- BOOL fSynchronous
- );
- private:
- BOOL SignalThreadProc() { return SetEvent(m_hCommandEvent); }
- private:
- CMSPCritSection m_CountLock; // Protects start count
- CMSPCritSection m_QueueLock; // Protects command queue
- int m_iStartCount; // number of times we've been
- // started minus number of times
- // we've been stopped. If == 0
- // then we actually stop thread.
- LIST_ENTRY m_CommandQueue; // Queue of commands for thread
- // to process.
- HANDLE m_hCommandEvent; // Signaled to tell us to do
- // something.
- HANDLE m_hThread; // The thread handle. We need to
- // save it so that we can wait
- // for it when stopping the
- // thread.
- HDEVNOTIFY m_hDevNotifyVideo; // Handles of device notification registration
- HDEVNOTIFY m_hDevNotifyAudio; // for video and audio devices.
- HWND m_hWndNotif; // Window handle for notification window
- PNOTIF_LIST m_NotifList; // List of notification functions to call
- // on a PNP event
- CMSPCritSection m_NotifLock; // Notification list critical section
- };
- extern CMSPThread g_Thread;
- #endif // __MSPTHRD_H
- // eof