Crates.io | handler_table |
lib.rs | handler_table |
version | 0.1.1 |
source | src |
created_at | 2023-05-09 15:56:17.20675 |
updated_at | 2024-07-11 05:33:42.06503 |
description | A lock-free table of event handlers |
homepage | https://github.com/arceos-org/arceos |
repository | https://github.com/arceos-org/handler_table |
max_upload_size | |
id | 860649 |
size | 5,623 |
A lock-free table of event handlers.
use handler_table::HandlerTable;
static TABLE: HandlerTable<8> = HandlerTable::new();
TABLE.register_handler(0, || {
println!("Hello, event 0!");
});
TABLE.register_handler(1, || {
println!("Hello, event 1!");
});
assert!(TABLE.handle(0)); // print "Hello, event 0!"
assert!(!TABLE.handle(2)); // unregistered