ultimatepp/bazaar/MtAltExample1/Worker.h
mrjt 1276dbc3ff Altenative MultiThreading package, plus example added to Bazaar on behalf of Pavel Ostapenko (Mindtraveller)
git-svn-id: svn://ultimatepp.org/upp/trunk@1395 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2009-07-10 15:42:31 +00:00

31 lines
639 B
C++

#ifndef _MtAltExample1_OtherThreadClasses_h_
#define _MtAltExample1_OtherThreadClasses_h_
#include <MtAlt/MtAlt.h>
using namespace Upp;
//new thread 1
class Worker : public CallbackThread
{
public: //thread GUI
class Notify { public: virtual void OnWork2Result(int x1, int x2, String s) = 0; };
Worker(Notify *n) :notify(n) {}
public: //thread 1
void DoWork1()
{
Sleep(300); //do something
}
void DoWork2()
{
Sleep(400); //do something
Time t = GetSysTime();
notify->OnWork2Result((int) Random(10), (int) Random(20), Format(t)); //notify result
}
private:
Notify *notify;
};
#endif