Fixed the following issues in XCEngine Core module documentation: - Added 'using namespace XCEngine::Core;' to all code examples that use Core types (Event, FileWriter, etc.) without full namespace qualification - Added missing '#include <XCEngine/Containers/String.h>' to FileWriter examples that use Containers::String - Added '#include <string>' to Flush.md example using std::to_string Affected files: - core/core.md: Added using directive and Containers include - event/*.md: Added using namespace to all 8 event doc files - filewriter/*.md: Added using namespace and proper includes to all 6 files
765 B
765 B
Event::ProcessUnsubscribes
void ProcessUnsubscribes();
处理积压的退订请求。
描述
手动处理待退订的回调,将其从订阅列表中移除。通常不需要手动调用,Invoke 会自动处理退订。但在某些场景下可能需要主动调用。
复杂度: O(n) 其中 n 为待退订数量
示例:
#include <XCEngine/Core/Event.h>
using namespace XCEngine::Core;
Event<int> event;
// 订阅
uint64_t id = event.Subscribe([](int value) { });
// 退订请求入队
event.Unsubscribe(id);
// 主动处理退订
event.ProcessUnsubscribes();
// 此时事件列表中已无该回调
相关文档
- Event 总览 - 返回类总览
- Unsubscribe - 退订事件