Simplify platform destructor.
- remove not needed code. Change-Id: I7fad36e651e33156a136467f8b2e32d88f13ac13
This commit is contained in:
parent
5408913d38
commit
b52b1d0aea
|
@ -55,7 +55,7 @@ Platform *constructPlatform() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform::Platform() {
|
Platform::Platform() {
|
||||||
devices.reserve(64);
|
devices.reserve(4);
|
||||||
setAsyncEventsHandler(std::unique_ptr<AsyncEventsHandler>(new AsyncEventsHandler()));
|
setAsyncEventsHandler(std::unique_ptr<AsyncEventsHandler>(new AsyncEventsHandler()));
|
||||||
executionEnvironment = new ExecutionEnvironment;
|
executionEnvironment = new ExecutionEnvironment;
|
||||||
executionEnvironment->incRefInternal();
|
executionEnvironment->incRefInternal();
|
||||||
|
@ -63,27 +63,14 @@ Platform::Platform() {
|
||||||
|
|
||||||
Platform::~Platform() {
|
Platform::~Platform() {
|
||||||
asyncEventsHandler->closeThread();
|
asyncEventsHandler->closeThread();
|
||||||
TakeOwnershipWrapper<Platform> platformOwnership(*this);
|
|
||||||
executionEnvironment->decRefInternal();
|
|
||||||
|
|
||||||
if (state == StateNone) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto dev : this->devices) {
|
for (auto dev : this->devices) {
|
||||||
if (dev) {
|
if (dev) {
|
||||||
dev->decRefInternal();
|
dev->decRefInternal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
devices.clear();
|
|
||||||
state = StateNone;
|
|
||||||
|
|
||||||
delete platformInfo;
|
|
||||||
platformInfo = nullptr;
|
|
||||||
|
|
||||||
std::string().swap(compilerExtensions);
|
|
||||||
|
|
||||||
gtpinNotifyPlatformShutdown();
|
gtpinNotifyPlatformShutdown();
|
||||||
|
executionEnvironment->decRefInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
cl_int Platform::getInfo(cl_platform_info paramName,
|
cl_int Platform::getInfo(cl_platform_info paramName,
|
||||||
|
@ -157,7 +144,7 @@ bool Platform::initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_BREAK_IF(this->platformInfo);
|
DEBUG_BREAK_IF(this->platformInfo);
|
||||||
this->platformInfo = new PlatformInfo;
|
this->platformInfo.reset(new PlatformInfo);
|
||||||
|
|
||||||
this->devices.resize(numDevicesReturned);
|
this->devices.resize(numDevicesReturned);
|
||||||
for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) {
|
for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Platform : public BaseObject<_cl_platform_id> {
|
||||||
cl_uint state = StateNone;
|
cl_uint state = StateNone;
|
||||||
void fillGlobalDispatchTable();
|
void fillGlobalDispatchTable();
|
||||||
|
|
||||||
PlatformInfo *platformInfo = nullptr;
|
std::unique_ptr<PlatformInfo> platformInfo;
|
||||||
DeviceVector devices;
|
DeviceVector devices;
|
||||||
std::string compilerExtensions;
|
std::string compilerExtensions;
|
||||||
std::unique_ptr<AsyncEventsHandler> asyncEventsHandler;
|
std::unique_ptr<AsyncEventsHandler> asyncEventsHandler;
|
||||||
|
|
Loading…
Reference in New Issue