mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 20:50:02 +00:00
async init, crashes now on get()
This commit is contained in:
@@ -184,6 +184,9 @@ namespace IfcGeom {
|
|||||||
|
|
||||||
boost::optional<bool> initialization_outcome_;
|
boost::optional<bool> initialization_outcome_;
|
||||||
|
|
||||||
|
// Should not be destructed because, destructor is blocking
|
||||||
|
std::future<void> init_future_;
|
||||||
|
|
||||||
bool initialize() {
|
bool initialize() {
|
||||||
if (initialization_outcome_) {
|
if (initialization_outcome_) {
|
||||||
return *initialization_outcome_;
|
return *initialization_outcome_;
|
||||||
@@ -233,9 +236,10 @@ namespace IfcGeom {
|
|||||||
|
|
||||||
if (num_threads_ != 1) {
|
if (num_threads_ != 1) {
|
||||||
collect();
|
collect();
|
||||||
process_concurrently();
|
|
||||||
|
|
||||||
initialization_outcome_ = !all_processed_elements_.empty();
|
initialization_outcome_ = !tasks_.empty();
|
||||||
|
|
||||||
|
init_future_ = std::async(std::launch::async, [this]() { process_concurrently(); });
|
||||||
} else {
|
} else {
|
||||||
initialization_outcome_ = create();
|
initialization_outcome_ = create();
|
||||||
}
|
}
|
||||||
@@ -338,10 +342,10 @@ namespace IfcGeom {
|
|||||||
fu.get();
|
fu.get();
|
||||||
|
|
||||||
processed += 1;
|
processed += 1;
|
||||||
progress_ = processed * 50 / tasks_.size();
|
progress_ = processed * 100 / tasks_.size();
|
||||||
if (progress_ != old_progress) {
|
if (progress_ / 2 != old_progress) {
|
||||||
Logger::ProgressBar(progress_);
|
Logger::ProgressBar(progress_ / 2);
|
||||||
old_progress = progress_;
|
old_progress = progress_ / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user