/commonlibrary/c_utils/base/src/ |
H A D | event_demultiplexer.cpp | 67 uint32_t EventDemultiplexer::UpdateEventHandler(EventHandler* handler) in UpdateEventHandler() argument 69 if (handler == nullptr) { in UpdateEventHandler() 74 auto itor = eventHandlers_.find(handler->GetHandle()); in UpdateEventHandler() 76 eventHandlers_.insert(std::make_pair(handler->GetHandle(), handler->shared_from_this())); in UpdateEventHandler() 77 return Update(EPOLL_CTL_ADD, handler); in UpdateEventHandler() 80 if (handler->Events() == EventReactor::NONE_EVENT) { in UpdateEventHandler() 82 return Update(EPOLL_CTL_DEL, handler); in UpdateEventHandler() 85 if (handler != itor->second.get()) { in UpdateEventHandler() 88 return Update(EPOLL_CTL_MOD, handler); in UpdateEventHandler() 91 Update(int operation, EventHandler* handler) Update() argument [all...] |
H A D | event_reactor.cpp | 38 void EventReactor::UpdateEventHandler(EventHandler* handler) in UpdateEventHandler() argument 40 if ((handler != nullptr) && (handler->GetEventReactor() == this) && (demultiplexer_ != nullptr)) { in UpdateEventHandler() 41 if (demultiplexer_->UpdateEventHandler(handler) != 0) { in UpdateEventHandler() 101 std::shared_ptr<TimerEventHandler> handler = std::make_shared<TimerEventHandler>(this, interval, once); in ScheduleTimer() local 102 handler->SetTimerCallback(cb); in ScheduleTimer() 103 uint32_t ret = handler->Initialize(); in ScheduleTimer() 109 timerFd = handler->GetHandle(); in ScheduleTimer() 110 timerEventHandlers_.push_back(handler); in ScheduleTimer()
|
H A D | event_demultiplexer.h | 41 uint32_t UpdateEventHandler(EventHandler* handler); 44 uint32_t Update(int operation, EventHandler* handler);
|
H A D | event_reactor.h | 67 void UpdateEventHandler(EventHandler* handler);
|
/commonlibrary/c_utils/base/test/benchmarktest/event_benchmark_test/ |
H A D | event_benchmark_test.cpp | 102 void SetFdAndCallback(std::shared_ptr<IOEventHandler>& handler, benchmark::State& state) in SetFdAndCallback() argument 107 handler->SetFd(fd); in SetFdAndCallback() 108 AssertEqual(handler->GetFd(), fd, "handler->GetFd() did not equal fd as expected.", state); in SetFdAndCallback() 111 handler->SetCallback(&TestCallback); in SetFdAndCallback() 112 AssertUnequal(handler->GetCallback(), nullptr, in SetFdAndCallback() 113 "handler->GetCallback() was not different from nullptr as expected.", state); in SetFdAndCallback() 125 // 1. Create io event handler in BENCHMARK_F() 126 std::shared_ptr<IOEventHandler> handler = std::make_shared<IOEventHandler>(INVALID_FD); in BENCHMARK_F() local 129 SetFdAndCallback(handler, stat in BENCHMARK_F() 170 std::shared_ptr<IOEventHandler> handler = std::make_shared<IOEventHandler>(INVALID_FD); BENCHMARK_F() local 428 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); BENCHMARK_F() local 459 EventLoop(std::shared_ptr<TimerFdHandler>& handler, benchmark::State& state, std::thread& loopThread) EventLoop() argument 496 std::shared_ptr<TimerFdHandler> handler; BENCHMARK_F() local 529 std::shared_ptr<TimerFdHandler> handler; BENCHMARK_F() local 558 std::shared_ptr<TimerFdHandler> handler; BENCHMARK_F() local 593 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); BENCHMARK_F() local 641 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); BENCHMARK_F() local 816 std::shared_ptr<TimerEventHandler> handler = std::make_shared<TimerEventHandler>(timerFd, interval, once); ScheduleTimer() local 903 OnTimer(TimerEventHandler* handler, const TimerCallback& callback) OnTimer() argument 1377 std::shared_ptr<IOEventHandler> handler = std::make_shared<IOEventHandler>(); BENCHMARK_F() local 1406 std::shared_ptr<IOEventHandler> handler = std::make_shared<IOEventHandler>(fd, events); BENCHMARK_F() local 1431 std::shared_ptr<IOEventHandler> handler = std::make_shared<IOEventHandler>(fd, events); BENCHMARK_F() local [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/examples/ |
H A D | ylong_tokio_schedule.rs | 42 for handler in handlers { in ylong_schedule_task() 43 ylong_runtime::block_on(handler).unwrap(); in ylong_schedule_task() 59 for handler in handlers { in tokio_schedule_task() 60 runtime.block_on(handler).unwrap(); in tokio_schedule_task() 73 for handler in handlers { in ylong_schedule_fibbo_task() 74 ylong_runtime::block_on(handler).unwrap(); in ylong_schedule_fibbo_task() 91 for handler in handlers { in tokio_schedule_fibbo_task() 92 runtime.block_on(handler).unwrap(); in tokio_schedule_fibbo_task()
|
H A D | ylong_timer_latency.rs | 33 for handler in handlers { in main() 34 let time = ylong_runtime::block_on(handler).unwrap(); in main() 55 for handler in handlers { in main() 56 let time = runtime.block_on(handler).unwrap(); in main()
|
H A D | ylong_runtime_tcp.rs | 64 for handler in handlers { in ylong_tcp_send_recv() 65 ylong_runtime::block_on(handler).unwrap(); in ylong_tcp_send_recv()
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/ |
H A D | ylong_tokio_rwlock.rs | 60 for handler in handlers { in tokio_rwlock_read() 61 rt.block_on(handler).unwrap(); in tokio_rwlock_read() 85 for handler in handlers { in ylong_rwlock_read() 86 ylong_runtime::block_on(handler).unwrap(); in ylong_rwlock_read() 109 for handler in handlers { in tokio_rwlock_write() 110 rt.block_on(handler).unwrap(); in tokio_rwlock_write() 134 for handler in handlers { in ylong_rwlock_write() 135 ylong_runtime::block_on(handler).unwrap(); in ylong_rwlock_write() 165 for handler in handlers { in tokio_rwlock_write_read() 166 rt.block_on(handler) in tokio_rwlock_write_read() [all...] |
H A D | ylong_tokio_signal.rs | 46 for handler in handlers { 47 let _ = runtime.block_on(handler).unwrap(); 62 let handler = runtime.spawn(async move { 69 let _ = runtime.block_on(handler).unwrap(); 95 for handler in handlers { 96 let _ = runtime.block_on(handler).unwrap(); 111 let handler = runtime.spawn(async move { 118 let _ = runtime.block_on(handler).unwrap();
|
H A D | ylong_tokio_spawn_blocking.rs | 37 for handler in handlers { 38 let _ = runtime.block_on(handler).unwrap(); 58 for handler in handlers { 59 let _ = ylong_runtime::block_on(handler).unwrap();
|
H A D | ylong_tokio_udp.rs | 115 for handler in handlers { in ylong_udp_send_recv() 116 ylong_runtime::block_on(handler).unwrap(); in ylong_udp_send_recv() 156 for handler in handlers { in tokio_udp_send_recv() 157 runtime.block_on(handler).unwrap(); in tokio_udp_send_recv() 199 for handler in handlers { in ylong_udp_send_to_recv_from() 200 ylong_runtime::block_on(handler).unwrap(); in ylong_udp_send_to_recv_from() 240 for handler in handlers { in tokio_udp_send_to_recv_from() 241 runtime.block_on(handler).unwrap(); in tokio_udp_send_to_recv_from()
|
H A D | ylong_tokio_process.rs | 41 for handler in handlers { 42 runtime.block_on(handler).unwrap(); 66 for handler in handlers { 67 ylong_runtime::block_on(handler).unwrap();
|
H A D | ylong_tokio_schedule.rs | 35 for handler in handlers { 36 let _ = runtime.block_on(handler).unwrap(); 57 for handler in handlers { 58 let _ = ylong_runtime::block_on(handler).unwrap();
|
H A D | ylong_tokio_mutex.rs | 48 for handler in handlers { 49 let _ = runtime.block_on(handler).unwrap(); 78 for handler in handlers { 79 let _ = ylong_runtime::block_on(handler).unwrap();
|
H A D | ylong_tokio_tcp.rs | 66 for handler in handlers { 67 runtime.block_on(handler).unwrap(); 120 for handler in handlers { 121 ylong_runtime::block_on(handler).unwrap();
|
H A D | ylong_tokio_uds.rs | 65 for handler in handlers { 66 runtime.block_on(handler).unwrap(); 119 for handler in handlers { 120 ylong_runtime::block_on(handler).unwrap();
|
/commonlibrary/c_utils/base/test/unittest/common/ |
H A D | utils_event_test.cpp | 84 // 1. Create io event handler in HWTEST_F() 85 std::shared_ptr<IOEventHandler> handler = std::make_shared<IOEventHandler>(-1); in HWTEST_F() local 90 handler->SetFd(fd); in HWTEST_F() 91 EXPECT_EQ(handler->GetFd(), fd); in HWTEST_F() 94 handler->SetCallback(&TestCallback); in HWTEST_F() 95 EXPECT_NE(handler->GetCallback(), nullptr); in HWTEST_F() 98 handler->SetEvents(Events::EVENT_READ | Events::EVENT_WRITE); in HWTEST_F() 99 EXPECT_EQ(handler->GetEvents(), Events::EVENT_READ | Events::EVENT_WRITE); in HWTEST_F() 102 EXPECT_EQ(handler->Prev(), nullptr); in HWTEST_F() 103 EXPECT_EQ(handler in HWTEST_F() 128 std::shared_ptr<IOEventHandler> handler = std::make_shared<IOEventHandler>(-1); HWTEST_F() local 312 InitAndRun(std::shared_ptr<TimerFdHandler>& handler, const uint32_t interval, std::unique_ptr<IOEventReactor>& reactor, std::thread& loopThread) InitAndRun() argument 337 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); HWTEST_F() local 371 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); HWTEST_F() local 410 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); HWTEST_F() local 444 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); HWTEST_F() local 481 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); HWTEST_F() local 518 std::shared_ptr<TimerFdHandler> handler = std::make_shared<TimerFdHandler>(fd, &TimerCallback1); HWTEST_F() local 680 std::shared_ptr<TimerEventHandler> handler = std::make_shared<TimerEventHandler>(timerFd, interval, once); ScheduleTimer() local 765 OnTimer(TimerEventHandler* handler, const TimerCallback& callback) OnTimer() argument [all...] |
/commonlibrary/rust/ylong_runtime/ylong_signal/src/ |
H A D | unix.rs | 40 let mut handler: libc::sigaction = unsafe { mem::zeroed() }; variables 43 handler.sa_sigaction = new_action; 44 handler.sa_flags = libc::SA_RESTART | libc::SA_SIGINFO; 47 if libc::sigaction(sig_num, &handler, &mut old_act) != 0 { 62 // sig_info should not be null, but in a sig handler we cannot panic directly, 73 // There could be a race condition between swapping the old handler with the new 74 // handler and storing the change back to the global during the register 75 // procedure. Because of the race condition, the old handler and the new 77 // store the old handler into global before swapping the handler i [all...] |
H A D | lib.rs | 17 //! Provides methods to set or unset an action for signal handler. 59 /// handler as there are a lot of limitations (async-signal-safe) on what you 60 /// can do inside a signal handler. For example, you should not use blocking 67 /// println!("inside SIGTERM signal handler"); 72 pub unsafe fn register_signal_action<F>(sig_num: c_int, handler: F) -> io::Result<()> in register_signal_action() 76 common::Signal::register_action(sig_num, move |_| handler()) in register_signal_action() 101 /// Deregisters the signal handler of a signal along with all its previous 104 /// The remove of the signal handler will influence all components inside the
|
H A D | common.rs | 75 pub(super) unsafe fn register_action<F>(sig_num: c_int, handler: F) -> io::Result<()> 84 let act = Arc::new(handler); 147 let handler = |_info: &libc::siginfo_t| { in ut_signal_new() 151 let handler = Arc::new(handler); in ut_signal_new() 152 let signal = Signal::new(libc::SIGINT, handler).unwrap(); in ut_signal_new() 171 /// 6. Deregisters both signal's handler hook, checks if the return is ok.
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/bin/ |
H A D | ylong_tokio_mem.rs | 41 let handler = ylong_runtime::spawn(async move {}); in ylong_memory() 42 let _ = ylong_runtime::block_on(handler); in ylong_memory()
|