#ifndef WLThread_HEAD_H
#define WLThread_HEAD_H

#ifdef _MSC_VER
    #include <windows.h>
    #include <process.h>
    #define My_THREAD_HANDLE HANDLE
    #define MSecondSleep(a) Sleep((a))
#else
    #include <unistd.h>
    #include <pthread.h>
    #define My_THREAD_HANDLE pthread_t
    #define MSecondSleep(a) usleep((a * 1000))
#endif

class WLThread {
    public:
        WLThread();
        virtual ~WLThread();
        void RunThread(void (*callFun)(void *para), void *userPara, int microSecond);
        void CloseThread();

    private:
        static void *UserUIThread(void *para);
        void (*mUserCallFun)(void *para);
        void *mUserPara;
        int mRunThread;
        int mUserMSecond;
        My_THREAD_HANDLE hThread;
};

#endif
