Notifying mac handler correctly, using proper error codes for threads

master
Paul Sutton 10 years ago
parent e5c1d00a7c
commit e063d6e06d

@ -26,6 +26,7 @@
*/
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <stdbool.h>
@ -66,7 +67,7 @@ bool threads_new_rt_cpu(pthread_t *thread, void *(*start_routine) (void*), void
}
int err = pthread_create(thread, &attr, start_routine, arg);
if (err) {
if (1 == err) {
if (EPERM == err) {
perror("Failed to create thread - permission error. Running with root permissions?");
}
perror("pthread_create");

@ -148,8 +148,14 @@ void demux::process_pdu(sch_pdu *pdu_msg)
qbuff *dest_lch = mac_io_h->get(pdu_msg->get()->get_sdu_lcid());
if (dest_lch) {
dest_lch->send(pdu_msg->get()->get_sdu_ptr(), pdu_msg->get()->get_sdu_nbytes()*8);
Info("Sent MAC SDU len=%d bytes to lchid=%d\n",
Info("Sent MAC SDU len=%d bytes to lchid=%d\n",
pdu_msg->get()->get_sdu_nbytes(), pdu_msg->get()->get_sdu_lcid());
if (sdu_handler_) {
sdu_handler_->notify_new_sdu(pdu_msg->get()->get_sdu_lcid());
Info("Notified SDU handler len=%d bytes to lchid=%d\n",
pdu_msg->get()->get_sdu_nbytes(), pdu_msg->get()->get_sdu_lcid());
}
} else {
Error("Getting destination channel LCID=%d\n", pdu_msg->get()->get_sdu_lcid());
}
@ -163,15 +169,6 @@ void demux::process_pdu(sch_pdu *pdu_msg)
}
}
}
/* notify handler if registred */
if (sdu_handler_) {
pdu_msg->reset();
while(pdu_msg->next()) {
if (pdu_msg->get()->is_sdu()) {
sdu_handler_->notify_new_sdu(pdu_msg->get()->get_sdu_lcid());
}
}
}
}

Loading…
Cancel
Save