EXT Win Library - thread

The win::thread template encapsulates a thread into object created over specified function.


Interface:

template <int (*P) (void *), unsigned int stack = 0>
class win::thread {
    public:
        explicit thread (void * = 0);

    private:
        thread (const thread &);
        thread & operator = (const thread &);

    public:
        bool running () const throw ();
        bool failed () const throw ();

        int  result () const throw ();
        void wait () const throw ();
};

Details:

The thread is considered an object. It is created when the object is constructed and finishes along with destruction of the object or sooner. The destructor waits until the thread procedure ends. The thread object cannot be copied.

You will need to include "ext/win_bits/thread.cpp" into your project in order to use win::thread.

Examples:

#include <ext/win>

int procedure (void *) {
    // ...
    return 0;
};

int main () {
    win::thread <procedure> thread;
    win::thread <procedure> thread (ptr);
    // ...
    return 0;
};

Remarks

Use win::threadc template to create threads on member functions.


[index]