forked from premiere/premiere-libtorrent
use flag to prevent multiple calls to abort_jobs even when asserts are disabled
This commit is contained in:
parent
8d9c746149
commit
4dc2e6015d
|
@ -578,9 +578,10 @@ namespace aux {
|
|||
// indices into m_torrents to empty slots
|
||||
std::vector<storage_index_t> m_free_slots;
|
||||
|
||||
std::atomic_flag m_jobs_aborted = ATOMIC_FLAG_INIT;
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
int m_magic = 0x1337;
|
||||
std::atomic<bool> m_jobs_aborted{false};
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3211,7 +3211,7 @@ constexpr disk_job_flags_t disk_interface::cache_hit;
|
|||
void disk_io_thread::abort_jobs()
|
||||
{
|
||||
TORRENT_ASSERT(m_magic == 0x1337);
|
||||
TORRENT_ASSERT(!m_jobs_aborted.exchange(true));
|
||||
if (m_jobs_aborted.test_and_set()) return;
|
||||
|
||||
jobqueue_t jobs;
|
||||
m_disk_cache.clear(jobs);
|
||||
|
|
Loading…
Reference in New Issue