mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 18:13:49 +01:00
core: remove unneeded calls to mutex_init()
This commit is contained in:
parent
e03e20b7f6
commit
6fae042a60
@ -122,13 +122,12 @@ void hwtimer_wait(unsigned long ticks)
|
|||||||
{
|
{
|
||||||
DEBUG("hwtimer_wait ticks=%lu\n", ticks);
|
DEBUG("hwtimer_wait ticks=%lu\n", ticks);
|
||||||
|
|
||||||
mutex_t mutex;
|
|
||||||
|
|
||||||
if (ticks <= 6 || inISR()) {
|
if (ticks <= 6 || inISR()) {
|
||||||
hwtimer_spin(ticks);
|
hwtimer_spin(ticks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mutex_init(&mutex);
|
|
||||||
|
mutex_t mutex = MUTEX_INIT;
|
||||||
mutex_lock(&mutex);
|
mutex_lock(&mutex);
|
||||||
/* -2 is to adjust the real value */
|
/* -2 is to adjust the real value */
|
||||||
int res = hwtimer_set(ticks - 2, hwtimer_releasemutex, &mutex);
|
int res = hwtimer_set(ticks - 2, hwtimer_releasemutex, &mutex);
|
||||||
|
|||||||
@ -82,7 +82,7 @@ static packet_monitor_t packet_monitor;
|
|||||||
static handler_entry_t handlers[MAX_PACKET_HANDLERS];
|
static handler_entry_t handlers[MAX_PACKET_HANDLERS];
|
||||||
static const pm_table_t handler_table;
|
static const pm_table_t handler_table;
|
||||||
static const char *cc1100_event_handler_name = "cc1100_event_handler";
|
static const char *cc1100_event_handler_name = "cc1100_event_handler";
|
||||||
static mutex_t cc1100_mutex;
|
static mutex_t cc1100_mutex = MUTEX_INIT;
|
||||||
volatile int cc1100_mutex_pid;
|
volatile int cc1100_mutex_pid;
|
||||||
static vtimer_t cc1100_watch_dog;
|
static vtimer_t cc1100_watch_dog;
|
||||||
static timex_t cc1100_watch_dog_period;
|
static timex_t cc1100_watch_dog_period;
|
||||||
@ -175,7 +175,6 @@ void cc1100_phy_init(void)
|
|||||||
|
|
||||||
/* Initialize mutex */
|
/* Initialize mutex */
|
||||||
cc1100_mutex_pid = -1;
|
cc1100_mutex_pid = -1;
|
||||||
mutex_init(&cc1100_mutex);
|
|
||||||
|
|
||||||
/* Allocate event numbers and start cc1100 event process */
|
/* 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_pid = thread_create(event_handler_stack, sizeof(event_handler_stack), PRIORITY_CC1100, CREATE_STACKTEST,
|
||||||
|
|||||||
@ -85,7 +85,7 @@ static void transmission_start(void);
|
|||||||
static inline void clk_signal(void);
|
static inline void clk_signal(void);
|
||||||
|
|
||||||
/* mutex for exclusive measurement operation */
|
/* mutex for exclusive measurement operation */
|
||||||
mutex_t sht11_mutex;
|
mutex_t sht11_mutex = MUTEX_INIT;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static inline void clk_signal(void)
|
static inline void clk_signal(void)
|
||||||
@ -266,7 +266,6 @@ static uint8_t measure(uint8_t *p_value, uint8_t *p_checksum, uint8_t mode)
|
|||||||
void sht11_init(void)
|
void sht11_init(void)
|
||||||
{
|
{
|
||||||
sht11_temperature_offset = 0;
|
sht11_temperature_offset = 0;
|
||||||
mutex_init(&sht11_mutex);
|
|
||||||
SHT11_INIT;
|
SHT11_INIT;
|
||||||
hwtimer_wait(11 * HWTIMER_TICKS(1000));
|
hwtimer_wait(11 * HWTIMER_TICKS(1000));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,14 +121,14 @@ uint8_t frag_size;
|
|||||||
uint8_t reas_buf[512];
|
uint8_t reas_buf[512];
|
||||||
uint8_t comp_buf[512];
|
uint8_t comp_buf[512];
|
||||||
uint8_t first_frag = 0;
|
uint8_t first_frag = 0;
|
||||||
mutex_t fifo_mutex;
|
mutex_t fifo_mutex = MUTEX_INIT;
|
||||||
|
|
||||||
int ip_process_pid = 0;
|
int ip_process_pid = 0;
|
||||||
int nd_nbr_cache_rem_pid = 0;
|
int nd_nbr_cache_rem_pid = 0;
|
||||||
int contexts_rem_pid = 0;
|
int contexts_rem_pid = 0;
|
||||||
int transfer_pid = 0;
|
int transfer_pid = 0;
|
||||||
|
|
||||||
mutex_t lowpan_context_mutex;
|
mutex_t lowpan_context_mutex = MUTEX_INIT;
|
||||||
|
|
||||||
/* registered upper layer threads */
|
/* registered upper layer threads */
|
||||||
int sixlowpan_reg[SIXLOWPAN_MAX_REGISTERED];
|
int sixlowpan_reg[SIXLOWPAN_MAX_REGISTERED];
|
||||||
@ -1788,12 +1788,6 @@ int sixlowpan_lowpan_init(void)
|
|||||||
/* init mac-layer and radio transceiver */
|
/* init mac-layer and radio transceiver */
|
||||||
sixlowpan_mac_init();
|
sixlowpan_mac_init();
|
||||||
|
|
||||||
/* init lowpan context mutex */
|
|
||||||
mutex_init(&lowpan_context_mutex);
|
|
||||||
|
|
||||||
/* init packet_fifo mutex */
|
|
||||||
mutex_init(&fifo_mutex);
|
|
||||||
|
|
||||||
if (!ip_process_pid) {
|
if (!ip_process_pid) {
|
||||||
ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE,
|
ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE,
|
||||||
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
PRIORITY_MAIN - 1, CREATE_STACKTEST,
|
||||||
|
|||||||
@ -98,7 +98,7 @@ static etx_neighbor_t candidates[ETX_MAX_CANDIDATE_NEIGHBORS];
|
|||||||
* In this time, no packet may be handled, otherwise it could assume values
|
* In this time, no packet may be handled, otherwise it could assume values
|
||||||
* from the last round to count for this round.
|
* from the last round to count for this round.
|
||||||
*/
|
*/
|
||||||
mutex_t etx_mutex;
|
mutex_t etx_mutex = MUTEX_INIT;
|
||||||
//Transceiver command for sending ETX probes
|
//Transceiver command for sending ETX probes
|
||||||
transceiver_command_t tcmd;
|
transceiver_command_t tcmd;
|
||||||
|
|
||||||
@ -141,7 +141,6 @@ void etx_show_candidates(void)
|
|||||||
|
|
||||||
void etx_init_beaconing(ipv6_addr_t *address)
|
void etx_init_beaconing(ipv6_addr_t *address)
|
||||||
{
|
{
|
||||||
mutex_init(&etx_mutex);
|
|
||||||
own_address = address;
|
own_address = address;
|
||||||
//set code
|
//set code
|
||||||
puts("ETX BEACON INIT");
|
puts("ETX BEACON INIT");
|
||||||
|
|||||||
@ -50,8 +50,8 @@ char addr_str[IPV6_MAX_ADDR_STR_LEN];
|
|||||||
rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS];
|
rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS];
|
||||||
rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES];
|
rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES];
|
||||||
unsigned int rpl_process_pid;
|
unsigned int rpl_process_pid;
|
||||||
mutex_t rpl_recv_mutex;
|
mutex_t rpl_recv_mutex = MUTEX_INIT;
|
||||||
mutex_t rpl_send_mutex;
|
mutex_t rpl_send_mutex = MUTEX_INIT;
|
||||||
msg_t rpl_msg_queue[RPL_PKT_RECV_BUF_SIZE];
|
msg_t rpl_msg_queue[RPL_PKT_RECV_BUF_SIZE];
|
||||||
char rpl_process_buf[RPL_PROCESS_STACKSIZE];
|
char rpl_process_buf[RPL_PROCESS_STACKSIZE];
|
||||||
uint8_t rpl_buffer[BUFFER_SIZE - LL_HDR_LEN];
|
uint8_t rpl_buffer[BUFFER_SIZE - LL_HDR_LEN];
|
||||||
@ -73,8 +73,6 @@ rpl_of_t *rpl_get_of_for_ocp(uint16_t ocp)
|
|||||||
|
|
||||||
uint8_t rpl_init(int if_id)
|
uint8_t rpl_init(int if_id)
|
||||||
{
|
{
|
||||||
mutex_init(&rpl_send_mutex);
|
|
||||||
mutex_init(&rpl_recv_mutex);
|
|
||||||
rpl_instances_init();
|
rpl_instances_init();
|
||||||
|
|
||||||
/* initialize routing table */
|
/* initialize routing table */
|
||||||
|
|||||||
@ -343,8 +343,7 @@ int vtimer_sleep(timex_t time)
|
|||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
vtimer_t t;
|
vtimer_t t;
|
||||||
mutex_t mutex;
|
mutex_t mutex = MUTEX_INIT;
|
||||||
mutex_init(&mutex);
|
|
||||||
mutex_lock(&mutex);
|
mutex_lock(&mutex);
|
||||||
|
|
||||||
t.action = vtimer_callback_unlock;
|
t.action = vtimer_callback_unlock;
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
|
|
||||||
static mutex_t mutex;
|
static mutex_t mutex = MUTEX_INIT;
|
||||||
static volatile int indicator, count;
|
static volatile int indicator, count;
|
||||||
|
|
||||||
static char stack[KERNEL_CONF_STACKSIZE_MAIN];
|
static char stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||||
@ -42,7 +42,6 @@ int main(void)
|
|||||||
{
|
{
|
||||||
indicator = 0;
|
indicator = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
mutex_init(&mutex);
|
|
||||||
|
|
||||||
thread_create(stack,
|
thread_create(stack,
|
||||||
sizeof(stack),
|
sizeof(stack),
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#include "pthread.h"
|
#include "pthread.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
static mutex_t mutex;
|
static mutex_t mutex = MUTEX_INIT;
|
||||||
static struct pthread_cond_t cv;
|
static struct pthread_cond_t cv;
|
||||||
static volatile int is_finished;
|
static volatile int is_finished;
|
||||||
static volatile long count;
|
static volatile long count;
|
||||||
@ -55,7 +55,6 @@ int main(void)
|
|||||||
count = 0;
|
count = 0;
|
||||||
is_finished = 0;
|
is_finished = 0;
|
||||||
expected_value = 1000*1000;
|
expected_value = 1000*1000;
|
||||||
mutex_init(&mutex);
|
|
||||||
pthread_cond_init(&cv, NULL);
|
pthread_cond_init(&cv, NULL);
|
||||||
|
|
||||||
int pid = thread_create(stack,
|
int pid = thread_create(stack,
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#define PROBLEM 12
|
#define PROBLEM 12
|
||||||
|
|
||||||
mutex_t mtx;
|
mutex_t mtx = MUTEX_INIT;
|
||||||
|
|
||||||
volatile int storage = 1;
|
volatile int storage = 1;
|
||||||
int main_id;
|
int main_id;
|
||||||
@ -63,8 +63,6 @@ int main(void)
|
|||||||
{
|
{
|
||||||
main_id = thread_getpid();
|
main_id = thread_getpid();
|
||||||
|
|
||||||
mutex_init(&mtx);
|
|
||||||
|
|
||||||
printf("Problem: %d\n", PROBLEM);
|
printf("Problem: %d\n", PROBLEM);
|
||||||
|
|
||||||
msg_t args[PROBLEM];
|
msg_t args[PROBLEM];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user