Thread.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// Thread.h
//
// Cross-platform threads
//
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Thread_H
#define _Thread_H
#include <string>
#include "Defs.h"
#include "platform/Wait.h"
namespace OpenZWave
{
class ThreadImpl;
class Event;
class Thread: public Wait
{
public:
typedef void (*pfnThreadProc_t)( Event* _exitEvent, void* _context );
Thread( string const& _name );
bool Start( pfnThreadProc_t _pfnThreadProc, void* _context );
bool Stop();
void Sleep( uint32 _millisecs );
protected:
virtual bool IsSignalled();
virtual ~Thread();
private:
ThreadImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of a thread.
Event* m_exitEvent;
};
} // namespace OpenZWave
#endif //_Thread_H
OpenZWave::Thread::Start
bool Start(pfnThreadProc_t _pfnThreadProc, void *_context)
Definition: Thread.cpp:73
OpenZWave
Definition: Bitfield.h:34
Wait.h
OpenZWave::Event
Platform-independent definition of event objects.
Definition: Event.h:39
OpenZWave::Thread
Implements a platform-independent thread management class.
Definition: Thread.h:42
Defs.h
OpenZWave::Thread::Stop
bool Stop()
Definition: Thread.cpp:86
OpenZWave::Thread::pfnThreadProc_t
void(* pfnThreadProc_t)(Event *_exitEvent, void *_context)
Definition: Thread.h:45
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::Wait
Platform-independent definition of Wait objects.
Definition: Wait.h:41
OpenZWave::Thread::Thread
Thread(string const &_name)
Definition: Thread.cpp:48
OpenZWave::Thread::Sleep
void Sleep(uint32 _millisecs)
Definition: Thread.cpp:107
OpenZWave::Thread::IsSignalled
virtual bool IsSignalled()
Definition: Thread.cpp:119
OpenZWave::ThreadImpl
Windows-specific implementation of the Thread class.
Definition: windows/ThreadImpl.h:42
OpenZWave::Thread::~Thread
virtual ~Thread()
Definition: Thread.cpp:61