//
class Thread {
NOCOPY(Thread)
-public:
- class Identity {
- friend class Thread;
-
- Identity(pthread_t id) : mIdent(id) { }
- public:
- Identity() { }
-
- static Identity current() { return pthread_self(); }
-
- bool operator == (const Identity &other) const
- { return pthread_equal(mIdent, other.mIdent); }
-
- bool operator != (const Identity &other) const
- { return !(*this == other); }
-
- private:
- pthread_t mIdent;
- };
public:
Thread() { } // constructor
virtual void action() = 0; // the action to be performed
private:
- Identity self; // my own identity (instance constant)
-
static void *runner(void *); // argument to pthread_create
};