Skip to content

A WinAPI Thread class which uses the CreateThread function for class members.

Notifications You must be signed in to change notification settings

urbans0ft/WinAPI-ThreadClass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

WinAPI-ThreadClass

A WinAPI Thread class which uses the CreateThread function for class members.

Example

main.cpp

#include <iostream>
#include <string>

#include "Thread.h"

class HelloWorld
{
public:
    DWORD print ()
    {
        std::cout << "Hello World!" << std::endl;
        return 0;
    }
};
int main(void)
{
    // Random object with DWORD method (void)
    HelloWorld world;
    // thread should call print method of world.
    Thread<HelloWorld> thread(&world, &HelloWorld::print);
    if (thread.start())
        std::cout << "Thread start()" << std::endl;
    thread.join(); // wait for thread
    return 0;
}

Compilation tested with VS2008.

Output

Thread start();
Hello Wordl!

About

A WinAPI Thread class which uses the CreateThread function for class members.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages