#include #include #include #include #include #include "hackers_watch.h" #include "log.h" void *hackers_session_worker(void *sess) { hackers_worker(sess); return NULL; } struct session *hackers_session_create(pthread_t *thread) { struct session *session = malloc(sizeof(struct session)); if (session == NULL) { log_log(LOG_CRIT, "hackers_session_create(): malloc() failed to allocate memory"); exit(EXIT_FAILURE); } if (pthread_create(thread, NULL, hackers_session_worker, (void*)session)) { log_log(LOG_ERR, "unable to start hackers worker thread: %s", strerror(errno)); exit(EXIT_FAILURE); } return session; } void hackers_session_check(struct session *sess) { /* do nothing */ } void hackers_session_close(struct session *sess) { /* do nothing */ } void hackers_session_messup(struct session *sess) { pthread_rwlock_rdlock(&(sess->lock)); } void hackers_session_cleanup(struct session *sess) { pthread_rwlock_unlock(&(sess->lock)); }