Click here to Skip to main content
13,042,421 members (122,557 online)
Click here to Skip to main content

Stats

116.2K views
1.3K downloads
70 bookmarked
Posted 11 Mar 2003

CSPServer, State-based Protocol Server Class

, 11 Mar 2003
Class framework for creating client/server protocol servers
//***********************************************************************
// (c) Copyright 1999-2003 Santronics Software, Inc. All Rights Reserved.
//***********************************************************************
// File Name : thread.h
// Subsystem : thread class
// Date      : 03/03/2003
// Author    : Hector Santos, Santronics Software, Inc.
// VERSION   : 1.00P
//
// Revision History:
// Version  Date      Author  Comments
// -------  --------  ------  -------------------------------------------
// v1.00P   03/03/03  HLS     Public Release version
//***********************************************************************

#ifndef __THREAD_H
#define __THREAD_H

class CThread {
public:
    CThread(DWORD startflags = 0);
    virtual ~CThread();
    void Start();
    virtual void InitiateShutdown() { SetEvent(TerminateEvent); }
    virtual void Stop();
    virtual BOOL IsTerminated();
    HANDLE GetThreadHandle() { return ThreadHandle; }
    DWORD GetThreadId() { return tid; }
    void SetShutdownWaitTime(const DWORD msecs) { ShutdownWaitTime = msecs;}
    void SetStartFlags(const DWORD flags) { StartFlags = flags;}

protected:
    DWORD ShutdownWaitTime;
    HANDLE TerminateEvent;
    virtual void Go() = 0;

private:
    DWORD StartFlags;
    HANDLE ThreadHandle;
    DWORD tid;
    static unsigned __stdcall ThreadRoutine(void *p);
};

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

hector santos
United States United States
No Biography provided

You may also be interested in...

Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 12 Mar 2003
Article Copyright 2003 by hector santos
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid