handler_table

Crates.iohandler_table
lib.rshandler_table
version0.1.1
sourcesrc
created_at2023-05-09 15:56:17.20675
updated_at2024-07-11 05:33:42.06503
descriptionA lock-free table of event handlers
homepagehttps://github.com/arceos-org/arceos
repositoryhttps://github.com/arceos-org/handler_table
max_upload_size
id860649
size5,623
core (github:arceos-org:core)

documentation

https://docs.rs/handler_table

README

handler_table

Crates.io

A lock-free table of event handlers.

Examples

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
Commit count: 2

cargo fmt