mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
rename queueInGDThread to queueInMainThread
This commit is contained in:
parent
a31d07237f
commit
277f68bfd7
10 changed files with 25 additions and 19 deletions
|
@ -101,7 +101,8 @@ namespace geode {
|
|||
void updateResources();
|
||||
void updateResources(bool forceReload);
|
||||
|
||||
void queueInGDThread(ScheduledFunction func);
|
||||
[[deprecated("use queueInMainThread instead")]] void queueInGDThread(ScheduledFunction func);
|
||||
void queueInMainThread(ScheduledFunction func);
|
||||
void waitForModsToBeLoaded();
|
||||
|
||||
/**
|
||||
|
|
|
@ -91,7 +91,7 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
|
|||
void loadAssets() {
|
||||
if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) {
|
||||
this->updateLoadedModsLabel();
|
||||
Loader::get()->queueInGDThread([this]() {
|
||||
Loader::get()->queueInMainThread([this]() {
|
||||
this->loadAssets();
|
||||
});
|
||||
return;
|
||||
|
|
|
@ -668,7 +668,7 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) {
|
|||
}
|
||||
|
||||
auto const& eventModID = list.target->getMetadata().getID();
|
||||
Loader::get()->queueInGDThread([eventModID]() {
|
||||
Loader::get()->queueInMainThread([eventModID]() {
|
||||
ModInstallEvent(eventModID, UpdateFinished()).post();
|
||||
});
|
||||
|
||||
|
@ -741,7 +741,7 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) {
|
|||
}
|
||||
|
||||
void Index::cancelInstall(IndexItemHandle item) {
|
||||
Loader::get()->queueInGDThread([this, item]() {
|
||||
Loader::get()->queueInMainThread([this, item]() {
|
||||
if (m_impl->m_runningInstallations.count(item)) {
|
||||
m_impl->m_runningInstallations.at(item)->cancel();
|
||||
m_impl->m_runningInstallations.erase(item);
|
||||
|
@ -750,13 +750,13 @@ void Index::cancelInstall(IndexItemHandle item) {
|
|||
}
|
||||
|
||||
void Index::install(IndexInstallList const& list) {
|
||||
Loader::get()->queueInGDThread([this, list]() {
|
||||
Loader::get()->queueInMainThread([this, list]() {
|
||||
m_impl->installNext(0, list);
|
||||
});
|
||||
}
|
||||
|
||||
void Index::install(IndexItemHandle item) {
|
||||
Loader::get()->queueInGDThread([this, item]() {
|
||||
Loader::get()->queueInMainThread([this, item]() {
|
||||
if (m_impl->m_runningInstallations.count(item)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,11 @@ void Loader::updateResources(bool forceReload) {
|
|||
}
|
||||
|
||||
void Loader::queueInGDThread(ScheduledFunction func) {
|
||||
return m_impl->queueInGDThread(func);
|
||||
return m_impl->queueInMainThread(func);
|
||||
}
|
||||
|
||||
void Loader::queueInMainThread(ScheduledFunction func) {
|
||||
return m_impl->queueInMainThread(func);
|
||||
}
|
||||
|
||||
void Loader::waitForModsToBeLoaded() {
|
||||
|
|
|
@ -347,7 +347,7 @@ void Loader::Impl::populateModList(std::vector<ModMetadata>& modQueue) {
|
|||
|
||||
m_mods.insert({metadata.getID(), mod});
|
||||
|
||||
queueInGDThread([this, mod]() {
|
||||
queueInMainThread([this, mod]() {
|
||||
auto searchPath = dirs::getModRuntimeDir() / mod->getID() / "resources";
|
||||
CCFileUtils::get()->addSearchPath(searchPath.string().c_str());
|
||||
updateModResources(mod);
|
||||
|
@ -579,7 +579,7 @@ void Loader::Impl::refreshModGraph() {
|
|||
else
|
||||
m_loadingState = LoadingState::Mods;
|
||||
|
||||
queueInGDThread([]() {
|
||||
queueInMainThread([]() {
|
||||
Loader::get()->m_impl->continueRefreshModGraph();
|
||||
});
|
||||
}
|
||||
|
@ -619,7 +619,7 @@ void Loader::Impl::continueRefreshModGraph() {
|
|||
log::info("Took {}s", static_cast<float>(time) / 1000.f);
|
||||
|
||||
if (m_loadingState != LoadingState::Done) {
|
||||
queueInGDThread([]() {
|
||||
queueInMainThread([]() {
|
||||
Loader::get()->m_impl->continueRefreshModGraph();
|
||||
});
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ bool Loader::Impl::loadHooks() {
|
|||
return !thereWereErrors;
|
||||
}
|
||||
|
||||
void Loader::Impl::queueInGDThread(ScheduledFunction func) {
|
||||
void Loader::Impl::queueInMainThread(ScheduledFunction func) {
|
||||
std::lock_guard<std::mutex> lock(m_gdThreadMutex);
|
||||
m_gdThreadQueue.push_back(func);
|
||||
}
|
||||
|
|
|
@ -158,7 +158,8 @@ namespace geode {
|
|||
|
||||
json::Value processRawIPC(void* rawHandle, std::string const& buffer);
|
||||
|
||||
void queueInGDThread(ScheduledFunction func);
|
||||
void queueInMainThread(ScheduledFunction func);
|
||||
void queueInMainThread(ScheduledFunction func);
|
||||
void executeGDThreadQueue();
|
||||
|
||||
void logConsoleMessage(std::string const& msg);
|
||||
|
|
|
@ -155,7 +155,7 @@ std::vector<Hook*> Mod::Impl::getHooks() const {
|
|||
// Settings and saved values
|
||||
|
||||
Result<> Mod::Impl::loadData() {
|
||||
Loader::get()->queueInGDThread([&]() {
|
||||
Loader::get()->queueInMainThread([&]() {
|
||||
ModStateEvent(m_self, ModEventType::DataLoaded).post();
|
||||
});
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ void ModCell::onEnable(CCObject* sender) {
|
|||
else {
|
||||
tryOrAlert(m_mod->disable(), "Error disabling mod");
|
||||
}
|
||||
Loader::get()->queueInGDThread([this]() {
|
||||
Loader::get()->queueInMainThread([this]() {
|
||||
if (m_layer) {
|
||||
m_layer->updateAllStates();
|
||||
}
|
||||
|
|
|
@ -602,7 +602,7 @@ Result<> file::watchFile(ghc::filesystem::path const& file) {
|
|||
auto watcher = std::make_unique<FileWatcher>(
|
||||
file,
|
||||
[](auto const& path) {
|
||||
Loader::get()->queueInGDThread([=] {
|
||||
Loader::get()->queueInMainThread([=] {
|
||||
FileWatchEvent(path).post();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
Loader::get()->queueInGDThread([self = data->self, now, total]() {
|
||||
Loader::get()->queueInMainThread([self = data->self, now, total]() {
|
||||
std::lock_guard _(self->m_mutex);
|
||||
for (auto& prog : self->m_progresses) {
|
||||
prog(*self->m_self, now, total);
|
||||
|
@ -302,7 +302,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
|||
// request, then they may still cancel it
|
||||
m_finished = true;
|
||||
|
||||
Loader::get()->queueInGDThread([this, ret]() {
|
||||
Loader::get()->queueInMainThread([this, ret]() {
|
||||
std::lock_guard _(m_mutex);
|
||||
for (auto& then : m_thens) {
|
||||
then(*m_self, ret);
|
||||
|
@ -329,7 +329,7 @@ void SentAsyncWebRequest::Impl::doCancel() {
|
|||
}
|
||||
}
|
||||
|
||||
Loader::get()->queueInGDThread([this]() {
|
||||
Loader::get()->queueInMainThread([this]() {
|
||||
std::lock_guard _(m_mutex);
|
||||
for (auto& canc : m_cancelleds) {
|
||||
canc(*m_self);
|
||||
|
@ -366,7 +366,7 @@ void SentAsyncWebRequest::Impl::error(std::string const& error, int code) {
|
|||
m_statusCV.wait(lock, [this]() {
|
||||
return !m_paused;
|
||||
});
|
||||
Loader::get()->queueInGDThread([this, error, code]() {
|
||||
Loader::get()->queueInMainThread([this, error, code]() {
|
||||
{
|
||||
std::lock_guard _(m_mutex);
|
||||
for (auto& expect : m_expects) {
|
||||
|
|
Loading…
Reference in a new issue