2023-04-13 13:04:52 +08:00

25 lines
615 B
C++

//
// Created by dongl on 23-4-12.
//
#ifndef THREAD_POOL_V2_EVENT_H
#define THREAD_POOL_V2_EVENT_H
struct event {
int event_id;
bool terminate; // 是否需要结束的标志
bool is_working; // 该事件是否在工作
pthread_t pthread_id; // 线程id
std::function<void()> function_;
event(int eventId, const std::function<void()>& function)
: event_id(eventId), terminate(false), is_working(false), pthread_id(pthread_self()),
function_(function) {}
void operator() () {
function_();
}
};
#endif //THREAD_POOL_V2_EVENT_H