FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
August 01, 1999

Win32 Multithreading Made Easy

(Page 2 of 4)
August 1999/Win32 Multithreading Made Easy/Figure 2

Figure 2: Class Derived interface and implementation

/* ==========================================
Derived.h
========================================== */

#ifndef DERIVED_H #define DERIVED_H

#ifndef THREADABLEOBJECT_H #include "threadableobject.h" #endif

class Derived : public ThreadableObject { public: Derived(); ~Derived(); void SetChar( char ch );

// Pure Virtual function in MultiThread virtual bool ThreadableTask(DWORD* dwReturnCode);

private: char m_ch; int m_nCount; }; #endif

/* ========================================== Derived.cpp ========================================== */

#include "derived.h" #include <iostream>

Derived::Derived() :ThreadableObject() { m_ch = '\0'; m_nCount = 0; }

Derived::~Derived() {}

void Derived::SetChar(char ch) { m_ch = ch; }

bool Derived::ThreadableTask( DWORD* dwReturnCode ) { using namespace std;

while ( m_nCount < 100 ) { cout << m_ch; m_nCount++; // return true; }

*dwReturnCode = 0; return false; }

Previous Page | 1 | 2 | 3 | 4 Next Page
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK