mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
core: remove extra thread_create_arg() function
This commit is contained in:
parent
867246a09f
commit
ba1a15535b
@ -67,6 +67,7 @@
|
||||
* @param[in] priority priority of the new thread, lower mean higher priority
|
||||
* @param[in] flags optional flags for the creation of the new thread
|
||||
* @param[in] function pointer to the code that is executed in the new thread
|
||||
* @param[in] arg the argument to the function
|
||||
* @param[in] name a human readable descriptor for the thread
|
||||
*
|
||||
* @return value ``<0`` on error
|
||||
@ -76,7 +77,8 @@ int thread_create(char *stack,
|
||||
int stacksize,
|
||||
char priority,
|
||||
int flags,
|
||||
void (*function) (void),
|
||||
void *(*function)(void *arg),
|
||||
void *arg,
|
||||
const char *name);
|
||||
|
||||
int thread_create_arg(char *stack,
|
||||
|
@ -46,9 +46,22 @@
|
||||
volatile int lpm_prevent_sleep = 0;
|
||||
|
||||
extern int main(void);
|
||||
|
||||
static void idle_thread(void)
|
||||
static void *main_trampoline(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
#ifdef MODULE_AUTO_INIT
|
||||
auto_init();
|
||||
#endif
|
||||
|
||||
main();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *idle_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
while (1) {
|
||||
if (lpm_prevent_sleep) {
|
||||
lpm_set(LPM_IDLE);
|
||||
@ -59,6 +72,8 @@ static void idle_thread(void)
|
||||
/* lpm_set(LPM_POWERDOWN); */
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *main_name = "main";
|
||||
@ -67,12 +82,6 @@ const char *idle_name = "idle";
|
||||
static char main_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
static char idle_stack[KERNEL_CONF_STACKSIZE_IDLE];
|
||||
|
||||
#ifdef MODULE_AUTO_INIT
|
||||
#define MAIN_FUNC auto_init
|
||||
#else
|
||||
#define MAIN_FUNC ((void (*) (void)) main)
|
||||
#endif
|
||||
|
||||
void kernel_init(void)
|
||||
{
|
||||
dINT();
|
||||
@ -80,11 +89,11 @@ void kernel_init(void)
|
||||
|
||||
hwtimer_init();
|
||||
|
||||
if (thread_create(idle_stack, sizeof(idle_stack), PRIORITY_IDLE, CREATE_WOUT_YIELD | CREATE_STACKTEST, idle_thread, idle_name) < 0) {
|
||||
if (thread_create(idle_stack, sizeof(idle_stack), PRIORITY_IDLE, CREATE_WOUT_YIELD | CREATE_STACKTEST, idle_thread, NULL, idle_name) < 0) {
|
||||
printf("kernel_init(): error creating idle task.\n");
|
||||
}
|
||||
|
||||
if (thread_create(main_stack, sizeof(main_stack), PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST, MAIN_FUNC, main_name) < 0) {
|
||||
if (thread_create(main_stack, sizeof(main_stack), PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST, main_trampoline, NULL, main_name) < 0) {
|
||||
printf("kernel_init(): error creating main task.\n");
|
||||
}
|
||||
|
||||
|
@ -112,27 +112,7 @@ int thread_measure_stack_free(char *stack)
|
||||
return space_free;
|
||||
}
|
||||
|
||||
typedef union
|
||||
{
|
||||
void *ptr;
|
||||
void (*wo_args)(void);
|
||||
void (*w_args)(void *arg);
|
||||
} task_funcs_t;
|
||||
|
||||
static void *thread_create_entry(void *function_)
|
||||
{
|
||||
task_funcs_t function = { .ptr = function_ };
|
||||
function.wo_args();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int thread_create(char *stack, int stacksize, char priority, int flags, void (*function_)(void), const char *name)
|
||||
{
|
||||
task_funcs_t function = { .wo_args = function_ };
|
||||
return thread_create_arg(stack, stacksize, priority, flags, thread_create_entry, function.ptr, name);
|
||||
}
|
||||
|
||||
int thread_create_arg(char *stack, int stacksize, char priority, int flags, void *(*function)(void *arg), void *arg, const char *name)
|
||||
int thread_create(char *stack, int stacksize, char priority, int flags, void *(*function)(void *arg), void *arg, const char *name)
|
||||
{
|
||||
/* allocate our thread control block at the top of our stackspace */
|
||||
int total_stacksize = stacksize;
|
||||
|
@ -206,8 +206,10 @@ static bool timer_unlink(unsigned i)
|
||||
return do_yield;
|
||||
}
|
||||
|
||||
static void hwtimer_tick_handler(void)
|
||||
static void *hwtimer_tick_handler(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t msg_array[2];
|
||||
msg_init_queue(msg_array, sizeof (msg_array) / sizeof (*msg_array));
|
||||
while (1) {
|
||||
@ -218,6 +220,8 @@ static void hwtimer_tick_handler(void)
|
||||
set_next_alarm(true);
|
||||
eINT();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void stop_alarms(void)
|
||||
@ -394,6 +398,7 @@ void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
|
||||
1,
|
||||
CREATE_STACKTEST,
|
||||
hwtimer_tick_handler,
|
||||
NULL,
|
||||
"x86-hwtimer");
|
||||
hwtimer_ie = true;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ static vtimer_t cc1100_watch_dog;
|
||||
static timex_t cc1100_watch_dog_period;
|
||||
|
||||
static uint16_t cc1100_event_handler_pid;
|
||||
static void cc1100_event_handler_function(void);
|
||||
static void *cc1100_event_handler_function(void *);
|
||||
|
||||
static char event_handler_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
@ -179,7 +179,7 @@ void cc1100_phy_init(void)
|
||||
|
||||
/* Allocate event numbers and start cc1100 event process */
|
||||
cc1100_event_handler_pid = thread_create(event_handler_stack, sizeof(event_handler_stack), PRIORITY_CC1100, CREATE_STACKTEST,
|
||||
cc1100_event_handler_function, cc1100_event_handler_name);
|
||||
cc1100_event_handler_function, NULL, cc1100_event_handler_name);
|
||||
|
||||
/* Active watchdog for the first time */
|
||||
if (radio_mode == CC1100_MODE_CONSTANT_RX) {
|
||||
@ -622,8 +622,10 @@ int cc1100_set_packet_handler(protocol_t protocol, packet_handler_t handler)
|
||||
return pm_set_handler(&handler_table, protocol, handler);
|
||||
}
|
||||
|
||||
static void cc1100_event_handler_function(void)
|
||||
static void *cc1100_event_handler_function(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m;
|
||||
|
||||
while (1) {
|
||||
@ -693,6 +695,8 @@ static void cc1100_event_handler_function(void)
|
||||
|
||||
eINT();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -63,9 +63,11 @@ unsigned char big_buf[3 * 1024];
|
||||
char small_buf[PAYLOAD_SIZE];
|
||||
|
||||
#if RIOT_CCN_APPSERVER
|
||||
static void appserver_thread(void)
|
||||
static void *appserver_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
ccnl_riot_appserver_start(relay_pid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void riot_ccn_appserver(int argc, char **argv)
|
||||
@ -81,7 +83,7 @@ static void riot_ccn_appserver(int argc, char **argv)
|
||||
appserver_pid = thread_create(
|
||||
appserver_stack, sizeof(appserver_stack),
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
appserver_thread, "appserver");
|
||||
appserver_thread, NULL, "appserver");
|
||||
DEBUG("ccn-lite appserver on thread_id %d...\n", appserver_pid);
|
||||
}
|
||||
#endif
|
||||
@ -133,9 +135,11 @@ static void riot_ccn_register_prefix(int argc, char **argv)
|
||||
puts("done");
|
||||
}
|
||||
|
||||
static void relay_thread(void)
|
||||
static void *relay_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
ccnl_riot_relay_start(shell_max_cache_entries, shell_threshold_prefix, shell_threshold_aggregate);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void riot_ccn_relay_start(int argc, char **argv)
|
||||
@ -169,7 +173,7 @@ static void riot_ccn_relay_start(int argc, char **argv)
|
||||
relay_pid = thread_create(
|
||||
relay_stack, sizeof(relay_stack),
|
||||
PRIORITY_MAIN - 2, CREATE_STACKTEST,
|
||||
relay_thread, "relay");
|
||||
relay_thread, NULL, "relay");
|
||||
DEBUG("ccn-lite relay on thread_id %d...\n", relay_pid);
|
||||
}
|
||||
|
||||
|
@ -65,10 +65,12 @@ void populate_cache(void)
|
||||
msg_send(&m, relay_pid, 1);
|
||||
}
|
||||
|
||||
void second_thread(void)
|
||||
void *second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
set_address_handler(42);
|
||||
populate_cache();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -77,7 +79,8 @@ int main(void)
|
||||
|
||||
relay_pid = thread_getpid();
|
||||
|
||||
thread_create(t2_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN + 1, CREATE_STACKTEST, second_thread, "helper thread");
|
||||
thread_create(t2_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN + 1,
|
||||
CREATE_STACKTEST, second_thread, NULL, "helper thread");
|
||||
|
||||
printf("starting ccn-lite relay...\n");
|
||||
ccnl_riot_relay_start(CCNL_DEFAULT_MAX_CACHE_ENTRIES,
|
||||
|
@ -48,8 +48,10 @@
|
||||
char radio_stack_buffer[RADIO_STACK_SIZE];
|
||||
msg_t msg_q[RCV_BUFFER_SIZE];
|
||||
|
||||
void radio(void)
|
||||
void *radio(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m;
|
||||
radio_packet_t *p;
|
||||
radio_packet_length_t i;
|
||||
@ -92,6 +94,7 @@ void init_transceiver(void)
|
||||
PRIORITY_MAIN - 2,
|
||||
CREATE_STACKTEST,
|
||||
radio,
|
||||
NULL,
|
||||
"radio");
|
||||
|
||||
uint16_t transceivers = TRANSCEIVER_DEFAULT;
|
||||
|
@ -25,8 +25,10 @@
|
||||
#include "msg.h"
|
||||
#include "kernel.h"
|
||||
|
||||
void second_thread(void)
|
||||
void *second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
printf("2nd thread started, pid: %i\n", thread_getpid());
|
||||
msg_t m;
|
||||
|
||||
@ -36,6 +38,8 @@ void second_thread(void)
|
||||
m.content.value++;
|
||||
msg_reply(&m, &m);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char second_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
@ -49,7 +53,7 @@ int main(void)
|
||||
|
||||
int pid = thread_create(second_thread_stack, sizeof(second_thread_stack),
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
second_thread, "pong");
|
||||
second_thread, NULL, "pong");
|
||||
|
||||
m.content.value = 1;
|
||||
|
||||
|
@ -41,7 +41,7 @@ using namespace std;
|
||||
char threadA_stack [KERNEL_CONF_STACKSIZE_PRINTF];
|
||||
|
||||
/* thread's function */
|
||||
void threadA_func(void);
|
||||
void *threadA_func(void *arg);
|
||||
|
||||
/* main */
|
||||
int main()
|
||||
@ -50,7 +50,7 @@ int main()
|
||||
printf("\n");
|
||||
|
||||
/* create thread A */
|
||||
thread_create(threadA_stack, sizeof(threadA_stack), 0, CREATE_WOUT_YIELD, threadA_func, "thread A");
|
||||
thread_create(threadA_stack, sizeof(threadA_stack), 0, CREATE_WOUT_YIELD, threadA_func, NULL, "thread A");
|
||||
|
||||
printf("******** Hello, you're in thread %s ********\n", thread_getname(thread_getpid()));
|
||||
printf("We'll test C++ class and methods here!\n");
|
||||
@ -82,7 +82,7 @@ int main()
|
||||
}
|
||||
|
||||
/* thread A function implemetation */
|
||||
void threadA_func(void)
|
||||
void *threadA_func(void *)
|
||||
{
|
||||
int day = 13, month = 6, year = 2014;
|
||||
int ret_day;
|
||||
@ -104,4 +104,6 @@ void threadA_func(void)
|
||||
}
|
||||
|
||||
printf("\nThis demo ends here, press Ctrl-C to exit (if you're on native)!\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ void rpl_udp_ip(int argc, char **argv);
|
||||
void rpl_udp_ignore(int argc, char **argv);
|
||||
|
||||
/* monitoring thread */
|
||||
void rpl_udp_monitor(void);
|
||||
void *rpl_udp_monitor(void *arg);
|
||||
|
||||
extern radio_address_t id;
|
||||
extern ipv6_addr_t std_addr;
|
||||
|
@ -53,8 +53,10 @@ void rpl_udp_set_id(int argc, char **argv)
|
||||
printf("Set node ID to %u\n", id);
|
||||
}
|
||||
|
||||
void rpl_udp_monitor(void)
|
||||
void *rpl_udp_monitor(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m;
|
||||
radio_packet_t *p;
|
||||
ipv6_hdr_t *ipv6_buf;
|
||||
@ -111,6 +113,8 @@ void rpl_udp_monitor(void)
|
||||
printf("Unknown packet received, type %04X\n", m.type);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
transceiver_command_t tcmd;
|
||||
|
@ -90,7 +90,7 @@ void rpl_udp_init(int argc, char **argv)
|
||||
int monitor_pid = thread_create(
|
||||
monitor_stack_buffer, sizeof(monitor_stack_buffer),
|
||||
PRIORITY_MAIN - 2, CREATE_STACKTEST,
|
||||
rpl_udp_monitor, "monitor");
|
||||
rpl_udp_monitor, NULL, "monitor");
|
||||
DEBUGF("Register at transceiver %02X\n", TRANSCEIVER);
|
||||
transceiver_register(TRANSCEIVER, monitor_pid);
|
||||
ipv6_register_packet_handler(monitor_pid);
|
||||
|
@ -39,7 +39,7 @@
|
||||
char udp_server_stack_buffer[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
char addr_str[IPV6_MAX_ADDR_STR_LEN];
|
||||
|
||||
void init_udp_server(void);
|
||||
static void *init_udp_server(void *);
|
||||
|
||||
/* UDP server thread */
|
||||
void udp_server(int argc, char **argv)
|
||||
@ -50,12 +50,14 @@ void udp_server(int argc, char **argv)
|
||||
int udp_server_thread_pid = thread_create(
|
||||
udp_server_stack_buffer, sizeof(udp_server_stack_buffer),
|
||||
PRIORITY_MAIN, CREATE_STACKTEST,
|
||||
init_udp_server, "init_udp_server");
|
||||
init_udp_server, NULL, "init_udp_server");
|
||||
printf("UDP SERVER ON PORT %d (THREAD PID: %d)\n", HTONS(SERVER_PORT), udp_server_thread_pid);
|
||||
}
|
||||
|
||||
void init_udp_server(void)
|
||||
static void *init_udp_server(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
sockaddr6_t sa;
|
||||
char buffer_main[UDP_BUFFER_SIZE];
|
||||
int32_t recsize;
|
||||
@ -86,6 +88,8 @@ void init_udp_server(void)
|
||||
}
|
||||
|
||||
destiny_socket_close(sock);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* UDP send command */
|
||||
|
@ -75,8 +75,6 @@
|
||||
#define CONF_PAN_ID (0xabcd)
|
||||
#endif
|
||||
|
||||
extern int main(void);
|
||||
|
||||
void auto_init(void)
|
||||
{
|
||||
#ifdef MODULE_VTIMER
|
||||
@ -186,6 +184,4 @@ void auto_init(void)
|
||||
DEBUG("Auto init transport layer [destiny] module.\n");
|
||||
destiny_init_transport_layer();
|
||||
#endif
|
||||
|
||||
main();
|
||||
}
|
||||
|
@ -127,3 +127,10 @@ void chardev_loop(ringbuffer_t *rb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void *chardev_thread_entry(void *rb_)
|
||||
{
|
||||
ringbuffer_t *rb = rb_;
|
||||
chardev_loop(rb);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -11,5 +11,6 @@
|
||||
#include "ringbuffer.h"
|
||||
|
||||
void chardev_loop(ringbuffer_t *rb);
|
||||
void *chardev_thread_entry(void *rb_);
|
||||
|
||||
#endif /* __CHARDEV_THREAD_H */
|
||||
|
@ -81,11 +81,8 @@ typedef struct etx_neighbor_t {
|
||||
|
||||
//prototypes
|
||||
void etx_init_beaconing(ipv6_addr_t *address);
|
||||
void etx_beacon(void);
|
||||
void etx_clock(void);
|
||||
double etx_get_metric(ipv6_addr_t *address);
|
||||
void etx_update(etx_neighbor_t *neighbor);
|
||||
void etx_radio(void);
|
||||
|
||||
#define ETX_PKT_OPT (0) //Position of Option-Type-Byte
|
||||
#define ETX_PKT_OPTVAL (0x20) //Non-standard way of saying this is an ETX-Packet.
|
||||
|
@ -331,8 +331,10 @@ int is_our_address(ipv6_addr_t *addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ipv6_process(void)
|
||||
void *ipv6_process(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m_recv_lowpan, m_send_lowpan;
|
||||
msg_t m_recv, m_send;
|
||||
uint8_t i;
|
||||
|
@ -93,7 +93,7 @@ uint8_t *get_payload_buf_send(uint8_t ext_len);
|
||||
|
||||
int icmpv6_demultiplex(const icmpv6_hdr_t *hdr);
|
||||
int ipv6_init_as_router(void);
|
||||
void ipv6_process(void);
|
||||
void *ipv6_process(void *);
|
||||
ipv6_net_if_hit_t *ipv6_net_if_addr_prefix_eq(ipv6_net_if_hit_t *hit, ipv6_addr_t *addr);
|
||||
ipv6_net_if_hit_t *ipv6_net_if_addr_match(ipv6_net_if_hit_t *hit, const ipv6_addr_t *addr);
|
||||
uint32_t get_remaining_time(timex_t *t);
|
||||
|
@ -142,7 +142,6 @@ uint8_t context_len = 0;
|
||||
uint16_t local_address = 0;
|
||||
|
||||
int lowpan_init(int as_border);
|
||||
void lowpan_context_auto_remove(void);
|
||||
uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len,
|
||||
ipv6_hdr_t *ipv6_buf_extra, uint8_t *ptr);
|
||||
void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr,
|
||||
@ -358,15 +357,16 @@ void sixlowpan_lowpan_print_fifo_buffers(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void lowpan_transfer(void)
|
||||
static void *lowpan_transfer(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m_recv, m_send;
|
||||
ipv6_hdr_t *ipv6_buf;
|
||||
lowpan_reas_buf_t *current_buf;
|
||||
uint8_t gotosleep;
|
||||
|
||||
while (1) {
|
||||
|
||||
gotosleep = 1;
|
||||
mutex_lock(&fifo_mutex);
|
||||
current_buf = packet_fifo;
|
||||
@ -419,6 +419,8 @@ void lowpan_transfer(void)
|
||||
thread_sleep();
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint8_t ll_get_addr_match(net_if_eui64_t *src, net_if_eui64_t *dst)
|
||||
@ -1633,8 +1635,10 @@ lowpan_context_t *lowpan_context_num_lookup(uint8_t num)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void lowpan_context_auto_remove(void)
|
||||
static void *lowpan_context_auto_remove(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
timex_t minute = timex_set(60, 0);
|
||||
int i;
|
||||
int8_t to_remove[NDP_6LOWPAN_CONTEXT_MAX];
|
||||
@ -1657,6 +1661,8 @@ void lowpan_context_auto_remove(void)
|
||||
|
||||
mutex_unlock(&lowpan_context_mutex);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void init_reas_bufs(lowpan_reas_buf_t *buf)
|
||||
@ -1791,7 +1797,7 @@ int sixlowpan_lowpan_init(void)
|
||||
if (!ip_process_pid) {
|
||||
ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
ipv6_process, "ip_process");
|
||||
ipv6_process, NULL, "ip_process");
|
||||
}
|
||||
|
||||
if (ip_process_pid < 0) {
|
||||
@ -1802,7 +1808,7 @@ int sixlowpan_lowpan_init(void)
|
||||
|
||||
contexts_rem_pid = thread_create(con_buf, CON_STACKSIZE,
|
||||
PRIORITY_MAIN + 1, CREATE_STACKTEST,
|
||||
lowpan_context_auto_remove, "lowpan_context_rem");
|
||||
lowpan_context_auto_remove, NULL, "lowpan_context_rem");
|
||||
|
||||
if (contexts_rem_pid < 0) {
|
||||
return 0;
|
||||
@ -1810,7 +1816,7 @@ int sixlowpan_lowpan_init(void)
|
||||
|
||||
transfer_pid = thread_create(lowpan_transfer_buf, LOWPAN_TRANSFER_BUF_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
lowpan_transfer, "lowpan_transfer");
|
||||
lowpan_transfer, NULL, "lowpan_transfer");
|
||||
|
||||
if (transfer_pid < 0) {
|
||||
return 0;
|
||||
|
@ -63,8 +63,10 @@ static inline void mac_frame_short_to_eui64(net_if_eui64_t *eui64,
|
||||
eui64->uint8[7] = frame_short[0];
|
||||
}
|
||||
|
||||
void recv_ieee802154_frame(void)
|
||||
static void *recv_ieee802154_frame(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m;
|
||||
#if (defined(MODULE_AT86RF231) | \
|
||||
defined(MODULE_CC2420) | \
|
||||
@ -164,6 +166,8 @@ void recv_ieee802154_frame(void)
|
||||
DEBUG("Unknown packet received");
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void set_ieee802154_fcf_values(ieee802154_frame_t *frame, uint8_t dest_mode,
|
||||
@ -317,7 +321,7 @@ int sixlowpan_mac_send_ieee802154_frame(int if_id,
|
||||
int sixlowpan_mac_init(void)
|
||||
{
|
||||
int recv_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE,
|
||||
PRIORITY_MAIN - 2, CREATE_STACKTEST, recv_ieee802154_frame , "radio");
|
||||
PRIORITY_MAIN - 2, CREATE_STACKTEST, recv_ieee802154_frame, NULL, "radio");
|
||||
int if_id = -1;
|
||||
|
||||
while ((if_id = net_if_iter_interfaces(if_id)) >= 0) {
|
||||
|
@ -47,6 +47,10 @@ static uint8_t etx_count_packet_tx(etx_neighbor_t *candidate);
|
||||
static void etx_set_packets_received(void);
|
||||
static bool etx_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2);
|
||||
|
||||
static void *etx_beacon(void *);
|
||||
static void *etx_clock(void *);
|
||||
static void *etx_radio(void *);
|
||||
|
||||
//Buffer
|
||||
static char etx_beacon_buf[ETX_BEACON_STACKSIZE];
|
||||
static char etx_radio_buf[ETX_RADIO_STACKSIZE];
|
||||
@ -145,22 +149,24 @@ void etx_init_beaconing(ipv6_addr_t *address)
|
||||
|
||||
etx_beacon_pid = thread_create(etx_beacon_buf, ETX_BEACON_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
etx_beacon, "etx_beacon");
|
||||
etx_beacon, NULL, "etx_beacon");
|
||||
|
||||
etx_radio_pid = thread_create(etx_radio_buf, ETX_RADIO_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
etx_radio, "etx_radio");
|
||||
etx_radio, NULL, "etx_radio");
|
||||
|
||||
etx_clock_pid = thread_create(etx_clock_buf, ETX_CLOCK_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
etx_clock, "etx_clock");
|
||||
etx_clock, NULL, "etx_clock");
|
||||
//register at transceiver
|
||||
transceiver_register(TRANSCEIVER_CC1100, etx_radio_pid);
|
||||
puts("...[DONE]");
|
||||
}
|
||||
|
||||
void etx_beacon(void)
|
||||
static void *etx_beacon(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
/*
|
||||
* Sends a message every ETX_INTERVAL +/- a jitter-value (default is 10%) .
|
||||
* A correcting variable is needed to stay at a base interval of
|
||||
@ -207,6 +213,8 @@ void etx_beacon(void)
|
||||
|
||||
mutex_unlock(&etx_mutex);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
etx_neighbor_t *etx_find_candidate(ipv6_addr_t *address)
|
||||
@ -225,8 +233,10 @@ etx_neighbor_t *etx_find_candidate(ipv6_addr_t *address)
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
void etx_clock(void)
|
||||
static void *etx_clock(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
/*
|
||||
* Manages the etx_beacon thread to wake up every full second +- jitter
|
||||
*/
|
||||
@ -256,6 +266,8 @@ void etx_clock(void)
|
||||
jittercorrection = (ETX_MAX_JITTER) - jitter;
|
||||
jitter = (uint8_t)(rand() % ETX_JITTER_MOD);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
double etx_get_metric(ipv6_addr_t *address)
|
||||
@ -377,8 +389,10 @@ void etx_handle_beacon(ipv6_addr_t *candidate_address)
|
||||
etx_update(candidate);
|
||||
}
|
||||
|
||||
void etx_radio(void)
|
||||
static void *etx_radio(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m;
|
||||
radio_packet_t *p;
|
||||
|
||||
@ -423,6 +437,8 @@ void etx_radio(void)
|
||||
//packet is not for me, whatever
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void etx_update(etx_neighbor_t *candidate)
|
||||
|
@ -82,7 +82,7 @@ uint8_t rpl_init(int if_id)
|
||||
init_trickle();
|
||||
rpl_process_pid = thread_create(rpl_process_buf, RPL_PROCESS_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
rpl_process, "rpl_process");
|
||||
rpl_process, NULL, "rpl_process");
|
||||
|
||||
/* INSERT NEW OBJECTIVE FUNCTIONS HERE */
|
||||
rpl_objective_functions[0] = rpl_get_of0();
|
||||
@ -112,8 +112,10 @@ void rpl_init_root(void)
|
||||
rpl_init_root_mode();
|
||||
}
|
||||
|
||||
void rpl_process(void)
|
||||
void *rpl_process(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m_recv;
|
||||
msg_init_queue(rpl_msg_queue, RPL_PKT_RECV_BUF_SIZE);
|
||||
|
||||
|
@ -188,8 +188,10 @@ void recv_rpl_DAO_ACK(void);
|
||||
* sending and receiving RPL-based messages. Both are necessary because of parallel access from different
|
||||
* layers/modules of RIOT. May change with future structure changes.
|
||||
*
|
||||
* @param arg ignored
|
||||
* @returns nothing
|
||||
*/
|
||||
void rpl_process(void);
|
||||
void *rpl_process(void *arg);
|
||||
|
||||
/**
|
||||
* @brief Returns next hop from routing table.
|
||||
|
@ -28,10 +28,10 @@
|
||||
#include "debug.h"
|
||||
|
||||
/* thread stacks */
|
||||
char timer_over_buf[TRICKLE_TIMER_STACKSIZE];
|
||||
char interval_over_buf[TRICKLE_INTERVAL_STACKSIZE];
|
||||
char dao_delay_over_buf[DAO_DELAY_STACKSIZE];
|
||||
char routing_table_buf[RT_STACKSIZE];
|
||||
static char timer_over_buf[TRICKLE_TIMER_STACKSIZE];
|
||||
static char interval_over_buf[TRICKLE_INTERVAL_STACKSIZE];
|
||||
static char dao_delay_over_buf[DAO_DELAY_STACKSIZE];
|
||||
static char routing_table_buf[RT_STACKSIZE];
|
||||
|
||||
int timer_over_pid;
|
||||
int interval_over_pid;
|
||||
@ -56,6 +56,11 @@ timex_t I_time;
|
||||
timex_t dao_time;
|
||||
timex_t rt_time;
|
||||
|
||||
static void *trickle_timer_over(void *arg);
|
||||
static void *trickle_interval_over(void *arg);
|
||||
static void *dao_delay_over(void *arg);
|
||||
static void *rt_timer_over(void *arg);
|
||||
|
||||
void reset_trickletimer(void)
|
||||
{
|
||||
I = Imin;
|
||||
@ -80,17 +85,17 @@ void init_trickle(void)
|
||||
dao_counter = 0;
|
||||
timer_over_pid = thread_create(timer_over_buf, TRICKLE_TIMER_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
trickle_timer_over, "trickle_timer_over");
|
||||
trickle_timer_over, NULL, "trickle_timer_over");
|
||||
|
||||
interval_over_pid = thread_create(interval_over_buf, TRICKLE_INTERVAL_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
trickle_interval_over, "trickle_interval_over");
|
||||
trickle_interval_over, NULL, "trickle_interval_over");
|
||||
dao_delay_over_pid = thread_create(dao_delay_over_buf, DAO_DELAY_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
dao_delay_over, "dao_delay_over");
|
||||
dao_delay_over, NULL, "dao_delay_over");
|
||||
rt_timer_over_pid = thread_create(routing_table_buf, RT_STACKSIZE,
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||
rt_timer_over, "rt_timer_over");
|
||||
rt_timer_over, NULL, "rt_timer_over");
|
||||
}
|
||||
|
||||
void start_trickle(uint8_t DIOIntMin, uint8_t DIOIntDoubl,
|
||||
@ -121,8 +126,10 @@ void trickle_increment_counter(void)
|
||||
c++;
|
||||
}
|
||||
|
||||
void trickle_timer_over(void)
|
||||
static void *trickle_timer_over(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
ipv6_addr_t mcast;
|
||||
ipv6_addr_set_all_nodes_addr(&mcast);
|
||||
|
||||
@ -134,10 +141,14 @@ void trickle_timer_over(void)
|
||||
send_DIO(&mcast);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void trickle_interval_over(void)
|
||||
static void *trickle_interval_over(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
while (1) {
|
||||
thread_sleep();
|
||||
I = I * 2;
|
||||
@ -178,6 +189,7 @@ void trickle_interval_over(void)
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void delay_dao(void)
|
||||
@ -199,8 +211,9 @@ void long_delay_dao(void)
|
||||
vtimer_set_wakeup(&dao_timer, dao_time, dao_delay_over_pid);
|
||||
}
|
||||
|
||||
void dao_delay_over(void)
|
||||
static void *dao_delay_over(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
while (1) {
|
||||
thread_sleep();
|
||||
|
||||
@ -215,6 +228,7 @@ void dao_delay_over(void)
|
||||
long_delay_dao();
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void dao_ack_received(void)
|
||||
@ -223,8 +237,10 @@ void dao_ack_received(void)
|
||||
long_delay_dao();
|
||||
}
|
||||
|
||||
void rt_timer_over(void)
|
||||
static void *rt_timer_over(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
rpl_routing_entry_t *rt;
|
||||
|
||||
while (1) {
|
||||
@ -259,4 +275,6 @@ void rt_timer_over(void)
|
||||
/* Wake up every second */
|
||||
vtimer_usleep(1000000);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -27,9 +27,5 @@ void reset_trickletimer(void);
|
||||
void init_trickle(void);
|
||||
void start_trickle(uint8_t DIOINtMin, uint8_t DIOIntDoubl, uint8_t DIORedundancyConstatnt);
|
||||
void trickle_increment_counter(void);
|
||||
void trickle_timer_over(void);
|
||||
void trickle_interval_over(void);
|
||||
void delay_dao(void);
|
||||
void dao_delay_over(void);
|
||||
void dao_ack_received(void);
|
||||
void rt_timer_over(void);
|
||||
|
@ -44,7 +44,7 @@ int destiny_init_transport_layer(void)
|
||||
/* UDP */
|
||||
int udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE,
|
||||
PRIORITY_MAIN, CREATE_STACKTEST,
|
||||
udp_packet_handler, "udp_packet_handler");
|
||||
udp_packet_handler, NULL, "udp_packet_handler");
|
||||
|
||||
if (udp_thread_pid < 0) {
|
||||
return -1;
|
||||
@ -64,7 +64,7 @@ int destiny_init_transport_layer(void)
|
||||
|
||||
int tcp_thread_pid = thread_create(tcp_stack_buffer, TCP_STACK_SIZE,
|
||||
PRIORITY_MAIN, CREATE_STACKTEST,
|
||||
tcp_packet_handler, "tcp_packet_handler");
|
||||
tcp_packet_handler, NULL, "tcp_packet_handler");
|
||||
|
||||
if (tcp_thread_pid < 0) {
|
||||
return -1;
|
||||
@ -73,7 +73,7 @@ int destiny_init_transport_layer(void)
|
||||
ipv6_register_next_header_handler(IPV6_PROTO_NUM_TCP, tcp_thread_pid);
|
||||
|
||||
if (thread_create(tcp_timer_stack, TCP_TIMER_STACKSIZE, PRIORITY_MAIN + 1,
|
||||
CREATE_STACKTEST, tcp_general_timer, "tcp_general_timer") < 0) {
|
||||
CREATE_STACKTEST, tcp_general_timer, NULL, "tcp_general_timer") < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -306,8 +306,10 @@ void handle_tcp_no_flags_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
|
||||
}
|
||||
}
|
||||
|
||||
void tcp_packet_handler(void)
|
||||
void *tcp_packet_handler(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m_recv_ip, m_send_ip;
|
||||
ipv6_hdr_t *ipv6_header;
|
||||
tcp_hdr_t *tcp_header;
|
||||
|
@ -96,7 +96,7 @@ extern uint8_t global_context_counter;
|
||||
extern mutex_t global_sequence_counter_mutex;
|
||||
extern uint32_t global_sequence_counter;
|
||||
|
||||
void tcp_packet_handler(void);
|
||||
void *tcp_packet_handler(void *);
|
||||
uint16_t tcp_csum(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header);
|
||||
void printTCPHeader(tcp_hdr_t *tcp_header);
|
||||
void printArrayRange_tcp(uint8_t *udp_header, uint16_t len);
|
||||
|
@ -140,8 +140,10 @@ void inc_global_variables(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void tcp_general_timer(void)
|
||||
void *tcp_general_timer(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
vtimer_t tcp_vtimer;
|
||||
timex_t interval = timex_set(0, TCP_TIMER_RESOLUTION);
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#define TCP_TIMEOUT 2
|
||||
#define TCP_CONTINUE 3
|
||||
|
||||
void tcp_general_timer(void);
|
||||
void *tcp_general_timer(void *);
|
||||
|
||||
#endif /* TCP_TIMER_H_ */
|
||||
/**
|
||||
|
@ -45,8 +45,10 @@ uint16_t udp_csum(ipv6_hdr_t *ipv6_header, udp_hdr_t *udp_header)
|
||||
return (sum == 0) ? 0xffff : HTONS(sum);
|
||||
}
|
||||
|
||||
void udp_packet_handler(void)
|
||||
void *udp_packet_handler(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m_recv_ip, m_send_ip, m_recv_udp, m_send_udp;
|
||||
ipv6_hdr_t *ipv6_header;
|
||||
udp_hdr_t *udp_header;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define UDP_PKT_RECV_BUF_SIZE (64)
|
||||
|
||||
uint16_t udp_csum(ipv6_hdr_t *ipv6_header, udp_hdr_t *udp_header);
|
||||
void udp_packet_handler(void);
|
||||
void *udp_packet_handler(void *);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -76,11 +76,9 @@ static volatile int pthread_reaper_pid = -1;
|
||||
|
||||
static char pthread_reaper_stack[PTHREAD_REAPER_STACKSIZE];
|
||||
|
||||
static void pthread_start_routine(void)
|
||||
static void *pthread_start_routine(void *pt_)
|
||||
{
|
||||
pthread_t self = pthread_self();
|
||||
|
||||
pthread_thread_t *pt = pthread_sched_threads[self-1];
|
||||
pthread_thread_t *pt = pt_;
|
||||
void *retval = pt->start_routine(pt->arg);
|
||||
pthread_exit(retval);
|
||||
}
|
||||
@ -100,14 +98,18 @@ static int insert(pthread_thread_t *pt)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void pthread_reaper(void)
|
||||
static void *pthread_reaper(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
while (1) {
|
||||
msg_t m;
|
||||
msg_receive(&m);
|
||||
DEBUG("pthread_reaper(): free(%p)\n", m.content.ptr);
|
||||
free(m.content.ptr);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
|
||||
@ -139,6 +141,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
|
||||
0,
|
||||
CREATE_STACKTEST,
|
||||
pthread_reaper,
|
||||
NULL,
|
||||
"pthread-reaper");
|
||||
pthread_reaper_pid = pid;
|
||||
}
|
||||
@ -150,6 +153,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
|
||||
PRIORITY_MAIN,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
pthread_start_routine,
|
||||
pt,
|
||||
"pthread");
|
||||
if (pt->thread_pid < 0) {
|
||||
free(pt->stack);
|
||||
|
@ -106,7 +106,7 @@ char transceiver_stack[TRANSCEIVER_STACK_SIZE];
|
||||
|
||||
/*------------------------------------------------------------------------------------*/
|
||||
/* function prototypes */
|
||||
static void run(void);
|
||||
static void *run(void *arg);
|
||||
static void receive_packet(uint16_t type, uint8_t pos);
|
||||
#ifdef MODULE_CC110X_NG
|
||||
static void receive_cc110x_packet(radio_packet_t *trans_p);
|
||||
@ -180,7 +180,7 @@ void transceiver_init(transceiver_type_t t)
|
||||
/* Start the transceiver thread */
|
||||
int transceiver_start(void)
|
||||
{
|
||||
transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, PRIORITY_MAIN - 3, CREATE_STACKTEST, run, "Transceiver");
|
||||
transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, PRIORITY_MAIN - 3, CREATE_STACKTEST, run, NULL, "Transceiver");
|
||||
|
||||
if (transceiver_pid < 0) {
|
||||
puts("Error creating transceiver thread");
|
||||
@ -259,8 +259,10 @@ uint8_t transceiver_register(transceiver_type_t t, int pid)
|
||||
* @brief The main thread run, receiving and processing messages in an infinite
|
||||
* loop
|
||||
*/
|
||||
void run(void)
|
||||
static void *run(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m;
|
||||
transceiver_command_t *cmd;
|
||||
|
||||
@ -340,8 +342,8 @@ void run(void)
|
||||
*((int32_t *) cmd->data) = set_pan(cmd->transceivers, cmd->data);
|
||||
msg_reply(&m, &m);
|
||||
break;
|
||||
#ifdef DBG_IGNORE
|
||||
|
||||
#ifdef DBG_IGNORE
|
||||
case DBG_IGN:
|
||||
*((int16_t *) cmd->data) = ignore_add(cmd->transceivers, cmd->data);
|
||||
msg_reply(&m, &m);
|
||||
@ -353,6 +355,8 @@ void run(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------------*/
|
||||
|
@ -45,11 +45,6 @@ static char buffer[UART0_BUFSIZE];
|
||||
|
||||
static char uart0_thread_stack[UART0_STACKSIZE];
|
||||
|
||||
static void uart0_loop(void)
|
||||
{
|
||||
chardev_loop(&uart0_ringbuffer);
|
||||
}
|
||||
|
||||
void board_uart0_init(void)
|
||||
{
|
||||
ringbuffer_init(&uart0_ringbuffer, buffer, UART0_BUFSIZE);
|
||||
@ -58,7 +53,8 @@ void board_uart0_init(void)
|
||||
sizeof(uart0_thread_stack),
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_STACKTEST | CREATE_SLEEPING,
|
||||
uart0_loop,
|
||||
chardev_thread_entry,
|
||||
&uart0_ringbuffer,
|
||||
"uart0"
|
||||
);
|
||||
uart0_handler_pid = pid;
|
||||
|
@ -33,8 +33,10 @@
|
||||
static char stacks[3][KERNEL_CONF_STACKSIZE_MAIN];
|
||||
static int pids[3];
|
||||
|
||||
static void first_thread(void)
|
||||
static void *first_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
puts("1st starting.");
|
||||
for (unsigned i = 0; i < LIMIT; ++i) {
|
||||
msg_t m;
|
||||
@ -44,14 +46,18 @@ static void first_thread(void)
|
||||
DEBUG("%u: Got msg with content %i\n", i, m.content.value);
|
||||
if (m.content.value != i + 1) {
|
||||
puts("ERROR. 1st");
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
puts("1st done.");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void second_thread(void)
|
||||
static void *second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
puts("2nd starting.");
|
||||
while (1) {
|
||||
msg_t m1;
|
||||
@ -63,7 +69,7 @@ static void second_thread(void)
|
||||
msg_send_receive(&m2, &m2, pids[2]);
|
||||
if (m2.content.value != m1.content.value) {
|
||||
puts("ERROR. 2nd");
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
++m1.content.value;
|
||||
@ -73,10 +79,14 @@ static void second_thread(void)
|
||||
}
|
||||
}
|
||||
puts("2nd done.");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void third_thread(void)
|
||||
static void *third_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
puts("3rd starting.");
|
||||
while (1) {
|
||||
msg_t m;
|
||||
@ -91,6 +101,8 @@ static void third_thread(void)
|
||||
}
|
||||
}
|
||||
puts("3rd done.");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -99,13 +111,13 @@ int main(void)
|
||||
|
||||
pids[0] = thread_create(stacks[0], sizeof(stacks[0]),
|
||||
PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
first_thread, "1st");
|
||||
first_thread, NULL, "1st");
|
||||
pids[1] = thread_create(stacks[1], sizeof(stacks[1]),
|
||||
PRIORITY_MAIN - 2, CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
second_thread, "2nd");
|
||||
second_thread, NULL, "2nd");
|
||||
pids[2] = thread_create(stacks[2], sizeof(stacks[2]),
|
||||
PRIORITY_MAIN - 3, CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
third_thread, "3nd");
|
||||
third_thread, NULL, "3nd");
|
||||
|
||||
puts("Main thread done.");
|
||||
return 0;
|
||||
|
@ -26,8 +26,10 @@
|
||||
char busy_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
volatile int busy, i, k;
|
||||
|
||||
void busy_thread(void)
|
||||
void *busy_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
int j = 0;
|
||||
puts("busy_thread starting");
|
||||
|
||||
@ -42,6 +44,8 @@ void busy_thread(void)
|
||||
printf("k: %i\n", k);
|
||||
|
||||
puts("success");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -50,8 +54,8 @@ int main(void)
|
||||
busy = 1;
|
||||
k = 23;
|
||||
thread_create(busy_stack, sizeof(busy_stack),
|
||||
PRIORITY_MAIN + 1, CREATE_WOUT_YIELD, busy_thread,
|
||||
"busy_thread");
|
||||
PRIORITY_MAIN + 1, CREATE_WOUT_YIELD,
|
||||
busy_thread, NULL, "busy_thread");
|
||||
puts("busy_thread created");
|
||||
|
||||
puts("hwtimer_wait()");
|
||||
|
@ -26,14 +26,16 @@ static mutex_t mutex;
|
||||
static volatile int indicator, count;
|
||||
|
||||
static char stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
static void second_thread(void)
|
||||
static void *second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
while (1) {
|
||||
mutex_lock(&mutex);
|
||||
thread_wakeup(1);
|
||||
indicator--;
|
||||
mutex_unlock_and_sleep(&mutex);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -47,6 +49,7 @@ int main(void)
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
second_thread,
|
||||
NULL,
|
||||
"second_thread");
|
||||
|
||||
while (1) {
|
||||
|
@ -48,8 +48,10 @@ uint8_t receiving = 1;
|
||||
unsigned int last_seq = 0, missed_cnt = 0;
|
||||
int first = -1;
|
||||
|
||||
void radio(void)
|
||||
void *radio(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
msg_t m;
|
||||
radio_packet_t *p;
|
||||
unsigned int tmp = 0, cur_seq = 0;
|
||||
@ -145,7 +147,7 @@ int main(void)
|
||||
radio_pid = thread_create(
|
||||
radio_stack_buffer, sizeof(radio_stack_buffer),
|
||||
PRIORITY_MAIN - 2, CREATE_STACKTEST,
|
||||
radio, "radio");
|
||||
radio, NULL, "radio");
|
||||
transceiver_register(TRANSCEIVER_NATIVE, radio_pid);
|
||||
#endif
|
||||
|
||||
|
@ -31,8 +31,9 @@ char test2_thread_stack[SEMAPHORE_TEST_THREADS][KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
sem_t s;
|
||||
|
||||
static void test1_second_thread(void)
|
||||
static void *test1_second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("second: sem_trywait");
|
||||
|
||||
if (sem_trywait(&s) == 0) {
|
||||
@ -50,6 +51,7 @@ static void test1_second_thread(void)
|
||||
puts("second: sem was posted");
|
||||
|
||||
puts("second: end");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void test1(void)
|
||||
@ -63,7 +65,7 @@ static void test1(void)
|
||||
puts("first: thread create");
|
||||
int pid = thread_create(test1_thread_stack, sizeof(test1_thread_stack),
|
||||
PRIORITY_MAIN - 1, CREATE_STACKTEST | CREATE_WOUT_YIELD,
|
||||
test1_second_thread, "second");
|
||||
test1_second_thread, NULL, "second");
|
||||
|
||||
if (pid < 0) {
|
||||
puts("first: thread create failed");
|
||||
@ -113,10 +115,12 @@ static void test1(void)
|
||||
puts("first: end");
|
||||
}
|
||||
|
||||
static void priority_sema_thread(void)
|
||||
static void *priority_sema_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
sem_wait(&s);
|
||||
printf("Thread '%s' woke up.\n", thread_getname(thread_getpid()));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char names[SEMAPHORE_TEST_THREADS][16];
|
||||
@ -135,7 +139,7 @@ void test2(void)
|
||||
printf("first: thread create: %d\n", priority);
|
||||
int pid = thread_create(test2_thread_stack[i],
|
||||
sizeof(test2_thread_stack[i]), priority, CREATE_STACKTEST,
|
||||
priority_sema_thread, names[i]);
|
||||
priority_sema_thread, NULL, names[i]);
|
||||
|
||||
if (pid < 0) {
|
||||
puts("first: thread create failed");
|
||||
|
@ -34,8 +34,9 @@ static char stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
* Then it signals one waiting thread to check the condition and it goes to sleep again
|
||||
* If is_finished is set to 1 second_thread ends
|
||||
*/
|
||||
static void second_thread(void)
|
||||
static void *second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
while (1) {
|
||||
mutex_lock(&mutex);
|
||||
|
||||
@ -46,6 +47,7 @@ static void second_thread(void)
|
||||
pthread_cond_signal(&cv);
|
||||
mutex_unlock_and_sleep(&mutex);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -61,6 +63,7 @@ int main(void)
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
second_thread,
|
||||
NULL,
|
||||
"second_thread");
|
||||
|
||||
while (1) {
|
||||
|
@ -64,8 +64,9 @@ static void do_sleep(int factor)
|
||||
vtimer_usleep(timeout_us);
|
||||
}
|
||||
|
||||
static void writer(void)
|
||||
static void *writer(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
/* PRINTF("%s", "start"); */
|
||||
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||
pthread_rwlock_wrlock(&rwlock);
|
||||
@ -76,10 +77,12 @@ static void writer(void)
|
||||
do_sleep(2);
|
||||
}
|
||||
/* PRINTF("%s", "done"); */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void reader(void)
|
||||
static void *reader(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
/* PRINTF("%s", "start"); */
|
||||
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||
pthread_rwlock_rdlock(&rwlock);
|
||||
@ -90,6 +93,7 @@ static void reader(void)
|
||||
do_sleep(1);
|
||||
}
|
||||
/* PRINTF("%s", "done"); */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -100,7 +104,7 @@ int main(void)
|
||||
|
||||
for (unsigned i = 0; i < NUM_CHILDREN; ++i) {
|
||||
int prio;
|
||||
void (*fun)(void);
|
||||
void *(*fun)(void *);
|
||||
const char *name;
|
||||
|
||||
if (i < NUM_READERS) {
|
||||
@ -124,7 +128,9 @@ int main(void)
|
||||
name = "writer";
|
||||
}
|
||||
|
||||
thread_create(stacks[i], sizeof(stacks[i]), prio, CREATE_WOUT_YIELD | CREATE_STACKTEST, fun, name);
|
||||
thread_create(stacks[i], sizeof(stacks[i]),
|
||||
prio, CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
fun, NULL, name);
|
||||
}
|
||||
|
||||
puts("Main done.");
|
||||
|
@ -35,8 +35,9 @@ static char names[NUM_CHILDREN][8];
|
||||
|
||||
static int parent_pid;
|
||||
|
||||
static void child_fun(void)
|
||||
static void *child_fun(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
printf("Start of %s.\n", sched_active_thread->name);
|
||||
|
||||
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||
@ -47,6 +48,7 @@ static void child_fun(void)
|
||||
}
|
||||
|
||||
printf("End of %s.\n", sched_active_thread->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -61,6 +63,7 @@ int main(void)
|
||||
PRIORITY_MAIN + 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
child_fun,
|
||||
NULL,
|
||||
names[i]);
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,11 @@
|
||||
|
||||
char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
void second_thread(void)
|
||||
void *second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("second thread\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -35,7 +37,7 @@ int main(void)
|
||||
(void) thread_create(
|
||||
t2_stack, sizeof(t2_stack),
|
||||
PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
second_thread, "nr2");
|
||||
second_thread, NULL, "nr2");
|
||||
puts("first thread\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,14 +34,16 @@ int main_id;
|
||||
int ths[PROBLEM];
|
||||
char stacks[PROBLEM][KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
void run(void)
|
||||
void *run(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
int err;
|
||||
int me = thread_getpid();
|
||||
printf("I am alive (%d)\n", me);
|
||||
msg_t arg;
|
||||
err = msg_receive(&arg);
|
||||
printf("Thread %d has arg %" PRIu32 "\n", me, arg.content.value);
|
||||
msg_t m;
|
||||
err = msg_receive(&m);
|
||||
printf("Thread %d has arg %" PRIu32 "\n", me, m.content.value);
|
||||
|
||||
err = mutex_lock(&mtx);
|
||||
|
||||
@ -49,7 +51,7 @@ void run(void)
|
||||
printf("[!!!] mutex_lock failed with %d\n", err);
|
||||
}
|
||||
|
||||
storage *= arg.content.value;
|
||||
storage *= m.content.value;
|
||||
mutex_unlock(&mtx);
|
||||
|
||||
msg_t final;
|
||||
@ -59,6 +61,8 @@ void run(void)
|
||||
if (err < 0) {
|
||||
printf("[!!!] Failed to send message from %d to main\n", me);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -78,7 +82,9 @@ int main(void)
|
||||
|
||||
for (int i = 0; i < PROBLEM; ++i) {
|
||||
printf("Creating thread with arg %d\n", (i + 1));
|
||||
ths[i] = thread_create(stacks[i], sizeof(stacks[i]), PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST, run, "thread");
|
||||
ths[i] = thread_create(stacks[i], sizeof(stacks[i]),
|
||||
PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
run, NULL, "thread");
|
||||
|
||||
if (ths[i] < 0) {
|
||||
printf("[!!!] Creating thread failed with %d\n", err);
|
||||
|
@ -27,20 +27,25 @@
|
||||
char second_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
char third_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
void fourth_thread(void)
|
||||
void *fourth_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("4th: starting");
|
||||
puts("4th: exiting");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void third_thread(void)
|
||||
void *third_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("3rd: starting");
|
||||
puts("3rd: exiting");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void second_thread(void)
|
||||
void *second_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("2nd: starting");
|
||||
|
||||
if ((thread_create(
|
||||
@ -49,6 +54,7 @@ void second_thread(void)
|
||||
PRIORITY_MAIN - 2,
|
||||
CREATE_STACKTEST,
|
||||
third_thread,
|
||||
NULL,
|
||||
"nr3")
|
||||
) == -1) {
|
||||
puts("2nd: Error creating 3rd thread.");
|
||||
@ -62,12 +68,14 @@ void second_thread(void)
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
fourth_thread,
|
||||
NULL,
|
||||
"nr4")
|
||||
) == -1) {
|
||||
puts("2nd: Error creating 4rd thread.");
|
||||
}
|
||||
|
||||
puts("2nd: exiting");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -80,6 +88,7 @@ int main(void)
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
second_thread,
|
||||
NULL,
|
||||
"nr2")
|
||||
) == -1) {
|
||||
puts("main: Error creating 3rd thread.");
|
||||
|
@ -29,8 +29,9 @@ char t3_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
uint16_t p1, p2, p3;
|
||||
|
||||
void thread1(void)
|
||||
void *thread1(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("THREAD 1 start\n");
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
@ -45,10 +46,12 @@ void thread1(void)
|
||||
}
|
||||
|
||||
puts("THREAD 1 end\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void thread2(void)
|
||||
void *thread2(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("THREAD 2\n");
|
||||
|
||||
for (int i = 0;; ++i) {
|
||||
@ -59,10 +62,13 @@ void thread2(void)
|
||||
reply.content.value = msg.content.value;
|
||||
msg_reply(&msg, &reply);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void thread3(void)
|
||||
void *thread3(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
puts("THREAD 3\n");
|
||||
|
||||
for (int i = 0;; ++i) {
|
||||
@ -71,16 +77,20 @@ void thread3(void)
|
||||
printf("T3 i=%d\n", i);
|
||||
msg_send(&msg, p1, 1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread1, "nr1");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
thread1, NULL, "nr1");
|
||||
p2 = thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread2, "nr2");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
thread2, NULL, "nr2");
|
||||
p3 = thread_create(t3_stack, sizeof(t3_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread3, "nr3");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
thread3, NULL, "nr3");
|
||||
puts("THREADS CREATED\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,8 +29,10 @@ char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
uint16_t p1, p_main;
|
||||
|
||||
void thread1(void)
|
||||
void *thread1(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
printf("THREAD %u start\n", p1);
|
||||
|
||||
msg_t msg, reply;
|
||||
@ -45,6 +47,8 @@ void thread1(void)
|
||||
printf("pointer: %s\n", reply.content.ptr);
|
||||
|
||||
printf("THREAD %u SHOULD BE BLOCKING :(\n", p1);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -56,7 +60,8 @@ int main(void)
|
||||
msg_init_queue(msg_q, 1);
|
||||
|
||||
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread1, "nr1");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
thread1, NULL, "nr1");
|
||||
|
||||
/* step 3: receive a msg */
|
||||
msg_receive(&msg);
|
||||
|
@ -29,8 +29,10 @@ char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
uint16_t p1, p_main;
|
||||
|
||||
void thread1(void)
|
||||
void *thread1(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
printf("THREAD %u start\n", p1);
|
||||
|
||||
msg_t msg, reply;
|
||||
@ -45,6 +47,8 @@ void thread1(void)
|
||||
printf("pointer: %s\n", reply.content.ptr);
|
||||
|
||||
printf("THREAD %u SHOULD BE BLOCKING :(\n", p1);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -53,7 +57,8 @@ int main(void)
|
||||
p_main = sched_active_pid;
|
||||
|
||||
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread1, "nr1");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
thread1, NULL, "nr1");
|
||||
|
||||
/* step 3: receive a msg */
|
||||
msg_receive(&msg);
|
||||
|
@ -31,8 +31,10 @@ char t3_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
uint16_t p1, p2, p3;
|
||||
|
||||
void sub_thread(void)
|
||||
void *sub_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
int pid = thread_getpid();
|
||||
printf("THREAD %s (pid:%i) start\n", thread_getname(pid), pid);
|
||||
|
||||
@ -43,6 +45,8 @@ void sub_thread(void)
|
||||
msg_send(&msg, 1, 1);
|
||||
|
||||
printf("THREAD %s (pid:%i) end.\n", thread_getname(pid), pid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -51,11 +55,14 @@ int main(void)
|
||||
msg_t msg;
|
||||
|
||||
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, sub_thread, "nr1");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
sub_thread, NULL, "nr1");
|
||||
p2 = thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, sub_thread, "nr2");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
sub_thread, NULL, "nr2");
|
||||
p3 = thread_create(t3_stack, sizeof(t3_stack), PRIORITY_MAIN - 1,
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST, sub_thread, "nr3");
|
||||
CREATE_WOUT_YIELD | CREATE_STACKTEST,
|
||||
sub_thread, NULL, "nr3");
|
||||
|
||||
puts("THREADS CREATED\n");
|
||||
for(int i = 0; i < 3; i++) {
|
||||
|
@ -40,8 +40,10 @@ timex_t now;
|
||||
struct timer_msg msg_a = { .interval = { .seconds = 2, .microseconds = 0}, .msg = "Hello World" };
|
||||
struct timer_msg msg_b = { .interval = { .seconds = 5, .microseconds = 0}, .msg = "This is a Test" };
|
||||
|
||||
void timer_thread(void)
|
||||
void *timer_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
printf("This is thread %d\n", thread_getpid());
|
||||
|
||||
/* we need a queue if the second message arrives while the first is still processed */
|
||||
@ -71,8 +73,10 @@ void timer_thread(void)
|
||||
}
|
||||
}
|
||||
|
||||
void timer_thread_local(void)
|
||||
void *timer_thread_local(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
printf("This is thread %d\n", thread_getpid());
|
||||
|
||||
while (1) {
|
||||
@ -94,6 +98,7 @@ int main(void)
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_STACKTEST,
|
||||
timer_thread,
|
||||
NULL,
|
||||
"timer");
|
||||
|
||||
puts("sending 1st msg");
|
||||
@ -110,6 +115,7 @@ int main(void)
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_STACKTEST,
|
||||
timer_thread_local,
|
||||
NULL,
|
||||
"timer local");
|
||||
|
||||
timex_t sleep = timex_set(1, 0);
|
||||
|
@ -51,8 +51,9 @@ struct timer_msg timer_msgs[] = { { .interval = { .seconds = 0, .microseconds =
|
||||
{ .interval = { .seconds = 1, .microseconds = 100000}, .msg = "T6", .start={0}, .count=0 },
|
||||
};
|
||||
|
||||
void timer_thread(void)
|
||||
void *timer_thread(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
printf("This is thread %d\n", thread_getpid());
|
||||
|
||||
msg_t msgq[16];
|
||||
@ -95,6 +96,8 @@ void timer_thread(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -106,6 +109,7 @@ int main(void)
|
||||
PRIORITY_MAIN - 1,
|
||||
CREATE_STACKTEST,
|
||||
timer_thread,
|
||||
NULL,
|
||||
"timer");
|
||||
|
||||
for (unsigned i = 0; i < sizeof(timer_msgs)/sizeof(struct timer_msg); i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user