Sha256: 110bb75c3a52d33906d0d0b5a27e90e6f5f25e32fc59a6d3a1b0e4e7042b82f0

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

#pragma once

#include "RhoStd.h"
#include "IRhoThreadImpl.h"
#include "AutoPointer.h"

namespace rho {
namespace common {

struct IRhoClassFactory;
class CRhoThread : public IRhoRunnable
{
    CAutoPtr<IRhoThreadImpl> m_pImpl;
    static const int TS_NONE = 0;
    static const int TS_WAIT = 1;
    static const int TS_STOPPING = 2;
    static const int TS_RUNNING = 4;

    int m_nState;
public:

    CRhoThread(IRhoClassFactory* factory);
    virtual ~CRhoThread(void){};

    virtual void start(EPriority ePriority);
    virtual void stop(unsigned int nTimeoutToKill){ m_nState |= TS_STOPPING; if (m_nState&TS_RUNNING) m_pImpl->stop(nTimeoutToKill); m_nState &= ~TS_STOPPING; }
    virtual void wait(unsigned int nTimeout){ m_nState |= TS_WAIT; if ((m_nState&TS_RUNNING) && !(m_nState&TS_STOPPING) ) m_pImpl->wait(nTimeout); m_nState &= ~TS_WAIT; }
    virtual void stopWait(){ /*if (isWaiting())*/ m_pImpl->stopWait(); }
    virtual void sleep(unsigned int nTimeout){ m_pImpl->sleep(nTimeout); }
    virtual void run() = 0;
    virtual void runObject()
    {
        run();
        m_nState = TS_NONE;
    }

    boolean isStopping(){return (m_nState&TS_STOPPING) != 0;}
    boolean isWaiting(){return (m_nState&TS_WAIT) != 0;}
    boolean isRunning(){return (m_nState&TS_RUNNING) != 0;}

};

}
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rhodes-2.2.4.beta.1 platform/shared/common/RhoThread.h
rhodes-2.2.3 platform/shared/common/RhoThread.h
rhodes-2.2.3.beta.1 platform/shared/common/RhoThread.h
rhodes-2.2.2 platform/shared/common/RhoThread.h
rhodes-2.2.2.beta.1 platform/shared/common/RhoThread.h
rhodes-2.2.1 platform/shared/common/RhoThread.h
rhodes-2.2.1.beta.2 platform/shared/common/RhoThread.h
rhodes-2.2.1.beta.1 platform/shared/common/RhoThread.h
rhodes-2.2.0 platform/shared/common/RhoThread.h
rhodes-2.2.0.beta.3 platform/shared/common/RhoThread.h
rhodes-2.2.0.beta.2 platform/shared/common/RhoThread.h
rhodes-2.2.0.beta.1 platform/shared/common/RhoThread.h