You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
636 B
C++
26 lines
636 B
C++
// SPDX-FileCopyrightText: 2026 Reion Wong <reionwong@gmail.com>
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
#include "base/thread_pool.h"
|
|
|
|
namespace cutefish::files {
|
|
|
|
// Drops value on a pool thread: freeing a listing of 50,000 items or its URL index
|
|
// takes the UI thread tens of milliseconds. value must own nothing tied to the
|
|
// calling thread.
|
|
template<typename T>
|
|
void releaseInBackground(T value)
|
|
{
|
|
auto owned = std::make_shared<T>(std::move(value));
|
|
base::ThreadPool::global().post([owned]() mutable {
|
|
owned.reset();
|
|
});
|
|
}
|
|
|
|
} // namespace cutefish::files
|