本文整理汇总了C++中EventQueue::call_in方法的典型用法代码示例。如果您正苦于以下问题:C++ EventQueue::call_in方法的具体用法?C++ EventQueue::call_in怎么用?C++ EventQueue::call_in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventQueue
的用法示例。
在下文中一共展示了EventQueue::call_in方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: call_in_test
void call_in_test() {
Timer tickers[N];
EventQueue queue;
for (int i = 0; i < N; i++) {
tickers[i].start();
queue.call_in((i+1)*100, time_func, &tickers[i], (i+1)*100);
}
queue.dispatch(N*100);
}
示例2: main
int main() {
// creates a queue with the default size
EventQueue queue;
// events are simple callbacks
queue.call(printf, "called immediately\n");
queue.call_in(2000, printf, "called in 2 seconds\n");
queue.call_every(1000, printf, "called every 1 seconds\n");
// events are executed by the dispatch method
queue.dispatch();
}
示例3: cancel_test1
void cancel_test1() {
EventQueue queue;
int ids[N];
for (int i = 0; i < N; i++) {
ids[i] = queue.call_in(1000, no);
}
for (int i = N-1; i >= 0; i--) {
queue.cancel(ids[i]);
}
queue.dispatch(0);
}