Files
rocm-systems/rocclr/runtime/platform/runtime.hpp
T

72 righe
1.4 KiB
C++

2014-07-04 16:17:05 -04:00
//
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef RUNTIME_HPP_
#define RUNTIME_HPP_
#include "top.hpp"
#include "thread/thread.hpp"
namespace amd {
/*! \addtogroup Runtime The OpenCL Runtime
* @{
*/
class Runtime : AllStatic {
static volatile bool initialized_;
2014-07-04 16:17:05 -04:00
public:
//! Return true if the OpencCL runtime is already initialized
inline static bool initialized();
2014-07-04 16:17:05 -04:00
//! Initialize the OpenCL runtime.
static bool init();
2014-07-04 16:17:05 -04:00
//! Tear down the runtime.
static void tearDown();
2014-07-04 16:17:05 -04:00
//! Return true if the Runtime is still single-threaded.
static bool singleThreaded() { return !initialized(); }
2014-07-04 16:17:05 -04:00
};
#if 0
class HostThread : public Thread
{
private:
virtual void run(void* data) { ShouldNotCallThis(); }
public:
HostThread() : Thread("HostThread", 0, false)
{
setHandle(NULL);
setCurrent();
if (!amd::Runtime::initialized() && !amd::Runtime::init()) {
return;
}
Os::currentStackInfo(&stackBase_, &stackSize_);
setState(RUNNABLE);
}
bool isHostThread() const { return true; };
static inline HostThread* current()
{
Thread* thread = Thread::current();
assert(thread->isHostThread() && "just checking");
return (HostThread*) thread;
}
};
#endif
/*@}*/
inline bool Runtime::initialized() { return initialized_; }
2014-07-04 16:17:05 -04:00
} // namespace amd
2014-07-04 16:17:05 -04:00
#endif /*RUNTIME_HPP_*/