diff options
Diffstat (limited to 'src/libserver/symcache/symcache_runtime.hxx')
-rw-r--r-- | src/libserver/symcache/symcache_runtime.hxx | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/libserver/symcache/symcache_runtime.hxx b/src/libserver/symcache/symcache_runtime.hxx index aa8f66c0f..7e4a41269 100644 --- a/src/libserver/symcache/symcache_runtime.hxx +++ b/src/libserver/symcache/symcache_runtime.hxx @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,12 @@ struct rspamd_scan_result; namespace rspamd::symcache { +enum class cache_item_status : std::uint16_t { + not_started = 0, + started = 1, + pending = 2, + finished = 3, +}; /** * These items are saved within task structure and are used to track * symbols execution. @@ -38,18 +44,23 @@ namespace rspamd::symcache { */ struct cache_dynamic_item { std::uint16_t start_msec; /* Relative to task time */ - bool started; - bool finished; + cache_item_status status; std::uint32_t async_events; }; static_assert(sizeof(cache_dynamic_item) == sizeof(std::uint64_t)); static_assert(std::is_trivial_v<cache_dynamic_item>); + class symcache_runtime { unsigned items_inflight; + + enum class slow_status : std::uint8_t { + none = 0, + enabled = 1, + disabled = 2, + } slow_status; bool profile; - bool has_slow; double profile_start; double lim; @@ -72,12 +83,7 @@ class symcache_runtime { public: /* Dropper for a shared ownership */ - auto savepoint_dtor() -> void - { - - /* Drop shared ownership */ - order.reset(); - } + auto savepoint_dtor(struct rspamd_task *task) -> void; /** * Creates a cache runtime using task mempool * @param task @@ -199,7 +205,9 @@ public: /* XXX: a helper to allow hiding internal implementation of the slow timer structure */ auto unset_slow() -> void { - has_slow = false; + if (slow_status == slow_status::enabled) { + slow_status = slow_status::disabled; + } } }; |