1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

make kernel_pid_t comparisons consistent

This commit is contained in:
Oleg Hahm 2014-08-06 11:52:00 +02:00
parent aa2ecf6216
commit 0ad7b170ed
10 changed files with 20 additions and 20 deletions

View File

@ -61,7 +61,7 @@ void at86rf231_rx_handler(void)
#endif #endif
/* notify transceiver thread if any */ /* notify transceiver thread if any */
if (transceiver_pid > KERNEL_PID_UNDEF) { if (transceiver_pid != KERNEL_PID_UNDEF) {
msg_t m; msg_t m;
m.type = (uint16_t) RCV_PKT_AT86RF231; m.type = (uint16_t) RCV_PKT_AT86RF231;
m.content.value = rx_buffer_next; m.content.value = rx_buffer_next;

View File

@ -86,7 +86,7 @@ void cc110x_rx_handler(void)
#endif #endif
/* notify transceiver thread if any */ /* notify transceiver thread if any */
if (transceiver_pid > KERNEL_PID_UNDEF) { if (transceiver_pid != KERNEL_PID_UNDEF) {
msg_t m; msg_t m;
m.type = (uint16_t) RCV_PKT_CC1100; m.type = (uint16_t) RCV_PKT_CC1100;
m.content.value = rx_buffer_next; m.content.value = rx_buffer_next;

View File

@ -78,7 +78,7 @@ void cc2420_rx_handler(void)
#endif #endif
/* notify transceiver thread if any */ /* notify transceiver thread if any */
if (transceiver_pid > KERNEL_PID_UNDEF) { if (transceiver_pid != KERNEL_PID_UNDEF) {
msg_t m; msg_t m;
m.type = (uint16_t) RCV_PKT_CC2420; m.type = (uint16_t) RCV_PKT_CC2420;
m.content.value = rx_buffer_next; m.content.value = rx_buffer_next;

View File

@ -123,7 +123,7 @@ void rpl_udp_ignore(int argc, char **argv)
{ {
uint16_t a; uint16_t a;
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not runnning."); puts("Transceiver not runnning.");
return; return;
} }

View File

@ -1794,7 +1794,7 @@ int sixlowpan_lowpan_init(void)
ipv6_process, NULL, "ip_process"); ipv6_process, NULL, "ip_process");
} }
if (ip_process_pid < 0) { if (ip_process_pid == KERNEL_PID_UNDEF) {
return 0; return 0;
} }
@ -1804,7 +1804,7 @@ int sixlowpan_lowpan_init(void)
PRIORITY_MAIN + 1, CREATE_STACKTEST, PRIORITY_MAIN + 1, CREATE_STACKTEST,
lowpan_context_auto_remove, NULL, "lowpan_context_rem"); lowpan_context_auto_remove, NULL, "lowpan_context_rem");
if (contexts_rem_pid < 0) { if (contexts_rem_pid == KERNEL_PID_UNDEF) {
return 0; return 0;
} }
@ -1812,7 +1812,7 @@ int sixlowpan_lowpan_init(void)
PRIORITY_MAIN - 1, CREATE_STACKTEST, PRIORITY_MAIN - 1, CREATE_STACKTEST,
lowpan_transfer, NULL, "lowpan_transfer"); lowpan_transfer, NULL, "lowpan_transfer");
if (transfer_pid < 0) { if (transfer_pid == KERNEL_PID_UNDEF) {
return 0; return 0;
} }

View File

@ -46,7 +46,7 @@ int destiny_init_transport_layer(void)
PRIORITY_MAIN, CREATE_STACKTEST, PRIORITY_MAIN, CREATE_STACKTEST,
udp_packet_handler, NULL, "udp_packet_handler"); udp_packet_handler, NULL, "udp_packet_handler");
if (udp_thread_pid < 0) { if (udp_thread_pid == KERNEL_PID_UNDEF) {
return -1; return -1;
} }
@ -66,7 +66,7 @@ int destiny_init_transport_layer(void)
PRIORITY_MAIN, CREATE_STACKTEST, PRIORITY_MAIN, CREATE_STACKTEST,
tcp_packet_handler, NULL, "tcp_packet_handler"); tcp_packet_handler, NULL, "tcp_packet_handler");
if (tcp_thread_pid < 0) { if (tcp_thread_pid == KERNEL_PID_UNDEF) {
return -1; return -1;
} }

View File

@ -117,7 +117,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
pthread_thread_t *pt = calloc(1, sizeof(pthread_thread_t)); pthread_thread_t *pt = calloc(1, sizeof(pthread_thread_t));
kernel_pid_t pthread_pid = insert(pt); kernel_pid_t pthread_pid = insert(pt);
if (pthread_pid < 0) { if (pthread_pid == KERNEL_PID_UNDEF) {
free(pt); free(pt);
return -1; return -1;
} }
@ -155,7 +155,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
pthread_start_routine, pthread_start_routine,
pt, pt,
"pthread"); "pthread");
if (pt->thread_pid < 0) { if (pt->thread_pid == KERNEL_PID_UNDEF) {
free(pt->stack); free(pt->stack);
free(pt); free(pt);
pthread_sched_threads[pthread_pid-1] = NULL; pthread_sched_threads[pthread_pid-1] = NULL;

View File

@ -68,7 +68,7 @@ void _transceiver_get_set_address_handler(int argc, char **argv)
transceiver_command_t tcmd; transceiver_command_t tcmd;
radio_address_t a; radio_address_t a;
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized"); puts("Transceiver not initialized");
return; return;
} }
@ -147,7 +147,7 @@ void _transceiver_get_set_long_addr_handler(int argc, char **argv)
transceiver_command_t tcmd; transceiver_command_t tcmd;
transceiver_eui64_t a; transceiver_eui64_t a;
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized"); puts("Transceiver not initialized");
return; return;
} }
@ -183,7 +183,7 @@ void _transceiver_get_set_channel_handler(int argc, char **argv)
transceiver_command_t tcmd; transceiver_command_t tcmd;
int32_t c; int32_t c;
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized"); puts("Transceiver not initialized");
return; return;
} }
@ -212,7 +212,7 @@ void _transceiver_get_set_channel_handler(int argc, char **argv)
void _transceiver_send_handler(int argc, char **argv) void _transceiver_send_handler(int argc, char **argv)
{ {
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized"); puts("Transceiver not initialized");
return; return;
} }
@ -264,7 +264,7 @@ void _transceiver_send_handler(int argc, char **argv)
/* checked for type safety */ /* checked for type safety */
void _transceiver_monitor_handler(int argc, char **argv) void _transceiver_monitor_handler(int argc, char **argv)
{ {
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized"); puts("Transceiver not initialized");
return; return;
} }
@ -290,7 +290,7 @@ void _transceiver_monitor_handler(int argc, char **argv)
/* checked for type safety */ /* checked for type safety */
void _transceiver_get_set_pan_handler(int argc, char **argv) void _transceiver_get_set_pan_handler(int argc, char **argv)
{ {
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized"); puts("Transceiver not initialized");
return; return;
} }
@ -325,7 +325,7 @@ void _transceiver_get_set_pan_handler(int argc, char **argv)
void _transceiver_set_ignore_handler(int argc, char **argv) void _transceiver_set_ignore_handler(int argc, char **argv)
{ {
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized"); puts("Transceiver not initialized");
return; return;
} }

View File

@ -182,7 +182,7 @@ kernel_pid_t transceiver_start(void)
{ {
transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, PRIORITY_MAIN - 3, CREATE_STACKTEST, run, NULL, "Transceiver"); transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, PRIORITY_MAIN - 3, CREATE_STACKTEST, run, NULL, "Transceiver");
if (transceiver_pid < 0) { if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Error creating transceiver thread"); puts("Error creating transceiver thread");
} }

View File

@ -71,7 +71,7 @@ static void test1(void)
NULL, NULL,
"second"); "second");
if (pid < 0) { if (pid == KERNEL_PID_UNDEF) {
puts("first: thread create failed"); puts("first: thread create failed");
} }