len = recvfrom(l->udp, (char *) &pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen);
if(len <= 0 || len > MAXSIZE) {
- if(!sockwouldblock(sockerrno)) {
- logger(LOG_ERR, "Receiving packet failed: %s", sockstrerror(sockerrno));
- return;
- }
- continue;
+ logger(LOG_ERR, "Receiving packet failed: %s", sockstrerror(sockerrno));
+ return;
}
pkt.len = len;
return !pthread_create(tid, NULL, (void *(*)(void *))func, arg);
}
static inline void thread_destroy(thread_t *tid) {
+ pthread_cancel(*tid);
pthread_join(*tid, NULL);
}
static inline void mutex_create(mutex_t *mutex) {