diff --git a/boards/avsextrem/drivers/avsextrem-smb380.c b/boards/avsextrem/drivers/avsextrem-smb380.c index 22749c94b0..1803b8c686 100644 --- a/boards/avsextrem/drivers/avsextrem-smb380.c +++ b/boards/avsextrem/drivers/avsextrem-smb380.c @@ -158,7 +158,7 @@ static void SMB380_simple_interrupthandler(void) if (interruptTicksSMB380 >= sampleRateSMB380 - 1) { interruptTicksSMB380 = 0; wakeupmessage.type = MSG_TYPE_SMB380_WAKEUP; - msg_send(&wakeupmessage, simple_pid, 0); + msg_try_send(&wakeupmessage, simple_pid); } else { interruptTicksSMB380++; @@ -566,7 +566,7 @@ void wakeUpRegisteredProcesses(void) while ((pointerNo < SMB380_RING_BUFF_MAX_THREADS) && (PointerList[pointerNo] > 0)) { - msg_send(&wakeupmessage, PointerList[pointerNo], false); + msg_try_send(&wakeupmessage, PointerList[pointerNo]); pointerNo++; } } diff --git a/core/msg.c b/core/msg.c index 1d89344e3d..f73966eea5 100644 --- a/core/msg.c +++ b/core/msg.c @@ -199,7 +199,7 @@ int msg_send_receive(msg_t *m, msg_t *reply, kernel_pid_t target_pid) /* msg_send blocks until reply received */ - return msg_send(m, target_pid, true); + return msg_send(m, target_pid); } int msg_reply(msg_t *m, msg_t *reply) diff --git a/examples/ccn-lite-client/main.c b/examples/ccn-lite-client/main.c index 22781bca49..bf807f638c 100644 --- a/examples/ccn-lite-client/main.c +++ b/examples/ccn-lite-client/main.c @@ -138,7 +138,7 @@ static void riot_ccn_relay_config(int argc, char **argv) msg_t m; m.content.value = atoi(argv[1]); m.type = CCNL_RIOT_CONFIG_CACHE; - msg_send(&m, _relay_pid, 1); + msg_send(&m, _relay_pid); } static void riot_ccn_transceiver_start(kernel_pid_t _relay_pid) @@ -195,7 +195,7 @@ static void riot_ccn_relay_stop(int argc, char **argv) msg_t m; m.content.value = 0; m.type = CCNL_RIOT_HALT; - msg_send(&m, _relay_pid, 1); + msg_send(&m, _relay_pid); /* mark relay as not running */ _relay_pid = 0; @@ -240,7 +240,7 @@ static void riot_ccn_pit_test(int argc, char **argv) m.content.ptr = (char *) &rmsg; m.type = CCNL_RIOT_MSG; - msg_send(&m, _relay_pid, 1); + msg_send(&m, _relay_pid); if ((segment % 50) == 0) { vtimer_now(&now); @@ -289,7 +289,7 @@ static void riot_ccn_populate(int argc, char **argv) msg_t m; m.content.value = 0; m.type = CCNL_RIOT_POPULATE; - msg_send(&m, _relay_pid, 1); + msg_send(&m, _relay_pid); } static void riot_ccn_stat(int argc, char **argv) @@ -300,7 +300,7 @@ static void riot_ccn_stat(int argc, char **argv) msg_t m; m.content.value = 0; m.type = CCNL_RIOT_PRINT_STAT; - msg_send(&m, _relay_pid, 1); + msg_send(&m, _relay_pid); } static const shell_command_t sc[] = { diff --git a/examples/ccn-lite-relay/main.c b/examples/ccn-lite-relay/main.c index 0354933f91..4d12a9c121 100644 --- a/examples/ccn-lite-relay/main.c +++ b/examples/ccn-lite-relay/main.c @@ -58,7 +58,7 @@ void populate_cache(void) msg_t m; m.content.value = 0; m.type = CCNL_RIOT_POPULATE; - msg_send(&m, _relay_pid, 1); + msg_send(&m, _relay_pid); } void *second_thread(void *arg) diff --git a/examples/rpl_udp/helper.c b/examples/rpl_udp/helper.c index 5eeee08f4d..475932a019 100644 --- a/examples/rpl_udp/helper.c +++ b/examples/rpl_udp/helper.c @@ -138,7 +138,7 @@ void rpl_udp_ignore(int argc, char **argv) if (argc == 2) { a = atoi(argv[1]); printf("sending to transceiver (%" PRIkernel_pid "): %u\n", transceiver_pid, (*(uint8_t *)tcmd.data)); - msg_send(&mesg, transceiver_pid, 1); + msg_send(&mesg, transceiver_pid); } else { printf("Usage: %s \n", argv[0]); diff --git a/sys/net/ccn_lite/ccnl-ext-appserver.c b/sys/net/ccn_lite/ccnl-ext-appserver.c index d33adccb58..73ac2f75af 100644 --- a/sys/net/ccn_lite/ccnl-ext-appserver.c +++ b/sys/net/ccn_lite/ccnl-ext-appserver.c @@ -52,7 +52,7 @@ static int appserver_sent_content(uint8_t *buf, int len, kernel_pid_t from) m.content.ptr = (char *) &rmsg; kernel_pid_t dest_pid = from; DEBUGMSG(1, "sending msg to pid=%" PRIkernel_pid "\n", dest_pid); - int ret = msg_send(&m, dest_pid, 1); + int ret = msg_send(&m, dest_pid); DEBUGMSG(1, "msg_reply returned: %d\n", ret); return ret; } diff --git a/sys/net/ccn_lite/ccnl-riot-compat.c b/sys/net/ccn_lite/ccnl-riot-compat.c index bbdc63b0b7..7edd6bfc83 100644 --- a/sys/net/ccn_lite/ccnl-riot-compat.c +++ b/sys/net/ccn_lite/ccnl-riot-compat.c @@ -95,7 +95,7 @@ int riot_send_msg(uint8_t *buf, uint16_t size, uint16_t to) m.type = CCNL_RIOT_MSG; m.content.ptr = (char *) rmsg; DEBUGMSG(1, "sending msg to pid=%" PRIkernel_pid "\n", to); - msg_send(&m, to, 1); + msg_send(&m, to); return size; } @@ -105,7 +105,7 @@ void riot_send_nack(uint16_t to) msg_t m; m.type = CCNL_RIOT_NACK; DEBUGMSG(1, "sending NACK msg to pid=%" PRIkernel_pid"\n", to); - msg_send(&m, to, 0); + msg_try_send(&m, to); } void *ccnl_riot_relay_helper_start(void *); diff --git a/sys/net/ccn_lite/util/ccnl-riot-client.c b/sys/net/ccn_lite/util/ccnl-riot-client.c index 1c317b1b89..f33d7d1f29 100644 --- a/sys/net/ccn_lite/util/ccnl-riot-client.c +++ b/sys/net/ccn_lite/util/ccnl-riot-client.c @@ -67,7 +67,7 @@ int ccnl_riot_client_get(kernel_pid_t relay_pid, char *name, char *reply_buf) msg_t m, rep; m.content.ptr = (char *) &rmsg; m.type = CCNL_RIOT_MSG; - msg_send(&m, relay_pid, 1); + msg_send(&m, relay_pid); /* ######################################################################### */ @@ -131,7 +131,7 @@ int ccnl_riot_client_new_face(kernel_pid_t relay_pid, char *type, char *faceid, m.content.ptr = (char *) &rmsg; m.type = CCNL_RIOT_MSG; DEBUGMSG(1, " sending face req to relay\n"); - msg_send(&m, relay_pid, 1); + msg_send(&m, relay_pid); /* ######################################################################### */ @@ -160,7 +160,7 @@ int ccnl_riot_client_register_prefix(kernel_pid_t relay_pid, char *prefix, char m.content.ptr = (char *) &rmsg; m.type = CCNL_RIOT_MSG; DEBUGMSG(1, " sending prefix req to relay\n"); - msg_send(&m, relay_pid, 1); + msg_send(&m, relay_pid); /* ######################################################################### */ diff --git a/sys/net/network_layer/sixlowpan/border/border.c b/sys/net/network_layer/sixlowpan/border/border.c index 09422b94ec..b53c456bec 100644 --- a/sys/net/network_layer/sixlowpan/border/border.c +++ b/sys/net/network_layer/sixlowpan/border/border.c @@ -113,7 +113,7 @@ void serial_reader_f(void) if (conf_packet->conftype == BORDER_CONF_SYN) { m.content.ptr = (char *)conf_packet; - msg_send(&m, main_pid, 1); + msg_send(&m, main_pid); continue; } } diff --git a/sys/net/network_layer/sixlowpan/border/flowcontrol.c b/sys/net/network_layer/sixlowpan/border/flowcontrol.c index 2b7478d96f..19240a86d2 100644 --- a/sys/net/network_layer/sixlowpan/border/flowcontrol.c +++ b/sys/net/network_layer/sixlowpan/border/flowcontrol.c @@ -43,7 +43,7 @@ ipv6_addr_t init_threeway_handshake(void) border_syn_packet_t *syn; msg_t m; m.content.ptr = NULL; - msg_send(&m, border_get_serial_reader(), 1); + msg_send(&m, border_get_serial_reader()); msg_receive(&m); syn = (border_syn_packet_t *)m.content.ptr; diff --git a/sys/net/network_layer/sixlowpan/ip.c b/sys/net/network_layer/sixlowpan/ip.c index 7f080bdbc0..a61a1d1d5f 100644 --- a/sys/net/network_layer/sixlowpan/ip.c +++ b/sys/net/network_layer/sixlowpan/ip.c @@ -262,7 +262,7 @@ int icmpv6_demultiplex(const icmpv6_hdr_t *hdr) if (_rpl_process_pid != KERNEL_PID_UNDEF) { msg_t m_send; m_send.content.ptr = (char *) &hdr->code; - msg_send(&m_send, _rpl_process_pid, 1); + msg_send(&m_send, _rpl_process_pid); } else { DEBUG("INFO: no RPL handler registered\n"); @@ -371,7 +371,7 @@ void *ipv6_process(void *arg) msg_t m_send; m_send.type = IPV6_PACKET_RECEIVED; m_send.content.ptr = (char *) ipv6_buf; - msg_send(&m_send, sixlowip_reg[i], 1); + msg_send(&m_send, sixlowip_reg[i]); } } diff --git a/sys/net/network_layer/sixlowpan/lowpan.c b/sys/net/network_layer/sixlowpan/lowpan.c index f7bdabef98..6e85a3514c 100644 --- a/sys/net/network_layer/sixlowpan/lowpan.c +++ b/sys/net/network_layer/sixlowpan/lowpan.c @@ -795,7 +795,7 @@ void lowpan_read(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, current_frame.length = length; current_frame.data = data; m_send.content.ptr = (char *) ¤t_frame; - msg_send(&m_send, sixlowpan_reg[i], 1); + msg_send(&m_send, sixlowpan_reg[i]); } } diff --git a/sys/net/transport_layer/socket_base/msg_help.c b/sys/net/transport_layer/socket_base/msg_help.c index 1dbe1e4ed3..4b9f6e6179 100644 --- a/sys/net/transport_layer/socket_base/msg_help.c +++ b/sys/net/transport_layer/socket_base/msg_help.c @@ -43,7 +43,11 @@ int socket_base_net_msg_reply(msg_t *m, msg_t *reply, uint16_t message) int socket_base_net_msg_send(msg_t *m, kernel_pid_t pid, bool block, uint16_t message) { m->type = message; - return msg_send(m, pid, block); + if (block) { + return msg_send(m, pid); + } else { + return msg_try_send(m, pid); + } } int socket_base_net_msg_send_recv(msg_t *m, msg_t *reply, kernel_pid_t pid, uint16_t message) diff --git a/sys/net/transport_layer/tcp/tcp.c b/sys/net/transport_layer/tcp/tcp.c index de35b5316d..65b0bc2e3f 100644 --- a/sys/net/transport_layer/tcp/tcp.c +++ b/sys/net/transport_layer/tcp/tcp.c @@ -477,12 +477,12 @@ void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, if (tcp_socket->socket_values.tcp_control.state == TCP_LAST_ACK) { uint8_t target_pid = tcp_socket->recv_pid; memset(tcp_socket, 0, sizeof(socket_internal_t)); - msg_send(&m_send_tcp, target_pid, 0); + msg_try_send(&m_send_tcp, target_pid); return; } else if (tcp_socket->socket_values.tcp_control.state == TCP_CLOSING) { - msg_send(&m_send_tcp, tcp_socket->recv_pid, 0); - msg_send(&m_send_tcp, tcp_socket->send_pid, 0); + msg_try_send(&m_send_tcp, tcp_socket->recv_pid); + msg_try_send(&m_send_tcp, tcp_socket->send_pid); return; } else if (get_waiting_connection_socket(tcp_socket->socket_id, ipv6_header, @@ -613,8 +613,8 @@ void handle_tcp_fin_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_header, TCP_ACK, 0); - msg_send(&m_send, tcp_socket->send_pid, 0); - msg_send(&m_send, tcp_socket->recv_pid, 0); + msg_try_send(&m_send, tcp_socket->send_pid); + msg_try_send(&m_send, tcp_socket->recv_pid); } void handle_tcp_no_flags_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, diff --git a/sys/shell/commands/sc_transceiver.c b/sys/shell/commands/sc_transceiver.c index b11edc3845..17ab19c0a0 100644 --- a/sys/shell/commands/sc_transceiver.c +++ b/sys/shell/commands/sc_transceiver.c @@ -285,7 +285,7 @@ void _transceiver_monitor_handler(int argc, char **argv) mesg.content.ptr = (char *) &tcmd; mesg.type = SET_MONITOR; - msg_send(&mesg, transceiver_pid, 1); + msg_send(&mesg, transceiver_pid); } /* checked for type safety */ diff --git a/sys/transceiver/transceiver.c b/sys/transceiver/transceiver.c index ab8e615f2f..87b46310ad 100644 --- a/sys/transceiver/transceiver.c +++ b/sys/transceiver/transceiver.c @@ -503,7 +503,7 @@ static void receive_packet(uint16_t type, uint8_t pos) m.content.ptr = (char *) &(transceiver_buffer[transceiver_buffer_pos]); DEBUG("transceiver: Notify thread %" PRIkernel_pid "\n", reg[i].pid); - if (msg_send(&m, reg[i].pid, false) && (m.type != ENOBUFFER)) { + if (msg_try_send(&m, reg[i].pid) && (m.type != ENOBUFFER)) { transceiver_buffer[transceiver_buffer_pos].processing++; } else { diff --git a/tests/nativenet/main.c b/tests/nativenet/main.c index ddc0d96399..5201bf3f10 100644 --- a/tests/nativenet/main.c +++ b/tests/nativenet/main.c @@ -124,7 +124,7 @@ void sender(void) snd_buffer[1] = i & 0x00FF; p.data = snd_buffer; i++; - msg_send(&mesg, transceiver_pid, 1); + msg_send(&mesg, transceiver_pid); hwtimer_wait(HWTIMER_TICKS(SENDING_DELAY)); } } diff --git a/tests/periph_uart_int/main.c b/tests/periph_uart_int/main.c index 3c272bc483..19c71845ec 100644 --- a/tests/periph_uart_int/main.c +++ b/tests/periph_uart_int/main.c @@ -61,7 +61,7 @@ void rx(void *ptr, char data) ringbuffer_add_one(&rx_buf, data); if (data == '\n') { - msg_send(&msg, main_pid, 1); + msg_send(&msg, main_pid); } } diff --git a/tests/queue_fairness/main.c b/tests/queue_fairness/main.c index 40d864a504..914354e784 100644 --- a/tests/queue_fairness/main.c +++ b/tests/queue_fairness/main.c @@ -42,7 +42,7 @@ static void *child_fun(void *arg) msg_t m; m.type = i + 1; m.content.ptr = (void *) sched_active_thread->name; - msg_send(&m, parent_pid, true); + msg_send(&m, parent_pid); } printf("End of %s.\n", sched_active_thread->name); diff --git a/tests/thread_cooperation/main.c b/tests/thread_cooperation/main.c index f5097027a5..ff42ef8942 100644 --- a/tests/thread_cooperation/main.c +++ b/tests/thread_cooperation/main.c @@ -50,7 +50,7 @@ void *run(void *arg) msg_t final; final.content.value = me; - int err = msg_send(&final, main_id, 1); + int err = msg_send(&final, main_id); if (err < 0) { printf("[!!!] Failed to send message from %d to main\n", me); @@ -79,7 +79,7 @@ int main(void) else { args[i].content.value = i + 1; - int err = msg_send(&args[i], ths[i], 1); + int err = msg_send(&args[i], ths[i]); if (err < 0) { printf("[!!!] Sending message to thread %d failed\n", ths[i]); } diff --git a/tests/thread_msg/main.c b/tests/thread_msg/main.c index 8cdef7d725..a2aebdfceb 100644 --- a/tests/thread_msg/main.c +++ b/tests/thread_msg/main.c @@ -76,7 +76,7 @@ void *thread3(void *arg) msg_t msg; msg.content.value = i; printf("T3 i=%d\n", i); - msg_send(&msg, p1, 1); + msg_send(&msg, p1); } return NULL; } diff --git a/tests/thread_msg_block_w_queue/main.c b/tests/thread_msg_block_w_queue/main.c index f322324410..24df29838d 100644 --- a/tests/thread_msg_block_w_queue/main.c +++ b/tests/thread_msg_block_w_queue/main.c @@ -39,7 +39,7 @@ void *thread1(void *arg) memset(&msg, 1, sizeof(msg_t)); /* step 1: send asynchonously */ - msg_send(&msg, p_main, 0); + msg_try_send(&msg, p_main); /* step 2: send message, turning its status into STATUS_REPLY_BLOCKED */ msg_send_receive(&msg, &reply, p_main); diff --git a/tests/thread_msg_block_wo_queue/main.c b/tests/thread_msg_block_wo_queue/main.c index 21f946ed9d..1808f2edcd 100644 --- a/tests/thread_msg_block_wo_queue/main.c +++ b/tests/thread_msg_block_wo_queue/main.c @@ -39,7 +39,7 @@ void *thread1(void *arg) memset(&msg, 1, sizeof(msg_t)); /* step 1: send asynchonously */ - msg_send(&msg, p_main, 0); + msg_try_send(&msg, p_main); /* step 2: send message, turning its status into STATUS_REPLY_BLOCKED */ msg_send_receive(&msg, &reply, p_main); diff --git a/tests/thread_msg_seq/main.c b/tests/thread_msg_seq/main.c index 239f2f1f97..717b0e4a1e 100644 --- a/tests/thread_msg_seq/main.c +++ b/tests/thread_msg_seq/main.c @@ -43,7 +43,7 @@ void *sub_thread(void *arg) msg.content.ptr = (char*)thread_getname(pid); - msg_send(&msg, p_main, true); + msg_send(&msg, p_main); printf("THREAD %s (pid:%" PRIkernel_pid ") end.\n", thread_getname(pid), pid); diff --git a/tests/vtimer_msg/main.c b/tests/vtimer_msg/main.c index 93969956c5..82800dc571 100644 --- a/tests/vtimer_msg/main.c +++ b/tests/vtimer_msg/main.c @@ -103,11 +103,11 @@ int main(void) puts("sending 1st msg"); m.content.ptr = (char *) &msg_a; - msg_send(&m, pid, false); + msg_try_send(&m, pid); puts("sending 2nd msg"); m.content.ptr = (char *) &msg_b; - msg_send(&m, pid, false); + msg_try_send(&m, pid); kernel_pid_t pid2 = thread_create( timer_stack_local, @@ -122,6 +122,6 @@ int main(void) while (1) { vtimer_sleep(sleep); - msg_send(&m, pid2, 0); + msg_try_send(&m, pid2); } } diff --git a/tests/vtimer_msg_diff/main.c b/tests/vtimer_msg_diff/main.c index 4f6de2cd6c..c4b5ce5d03 100644 --- a/tests/vtimer_msg_diff/main.c +++ b/tests/vtimer_msg_diff/main.c @@ -115,7 +115,7 @@ int main(void) for (unsigned i = 0; i < sizeof(timer_msgs)/sizeof(struct timer_msg); i++) { printf("Sending timer msg %u...\n", i); m.content.ptr = (char *) &timer_msgs[i]; - msg_send(&m, pid, false); + msg_try_send(&m, pid); } return 0;