forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kernel: Remove dependency on CScheduler
By defining a virtual interface class for the scheduler client, users of the kernel can now define their own event consuming infrastructure, without having to spawn threads or rely on the scheduler design. Removing CScheduler also allows removing the thread and exception modules from the kernel library.
- Loading branch information
1 parent
3a62410
commit 4780a10
Showing
9 changed files
with
76 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2023-present The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_TASK_QUEUE_INTERFACE_QUEUE_H | ||
#define BITCOIN_TASK_QUEUE_INTERFACE_QUEUE_H | ||
|
||
#include <cstddef> | ||
#include <functional> | ||
|
||
class TaskQueueInterface | ||
{ | ||
public: | ||
virtual ~TaskQueueInterface() {} | ||
|
||
/** | ||
* This is called for each subscriber on each validation interface event. | ||
* The callback can either be queued for later/asynchronous/threaded | ||
* processing, or be executed immediately for synchronous processing. | ||
* Synchronous processing will block validation. | ||
*/ | ||
virtual void AddToProcessQueue(std::function<void()> func) = 0; | ||
|
||
/** | ||
* This is called to force the processing of all queued events. | ||
*/ | ||
virtual void EmptyQueue() = 0; | ||
|
||
/** | ||
* Returns the number of queued events. | ||
*/ | ||
virtual size_t CallbacksPending() = 0; | ||
}; | ||
|
||
#endif // BITCOIN_TASK_QUEUE_INTERFACE_QUEUE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters