Skip to content

Commit

Permalink
read-write locks renamed to be less confusing
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuedtke committed Dec 4, 2024
1 parent 0f784e6 commit 8ea9959
Show file tree
Hide file tree
Showing 17 changed files with 272 additions and 272 deletions.
24 changes: 12 additions & 12 deletions src/highlevel/bidib_highlevel_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int bidib_ping(const char *board, uint8_t ping_byte) {
return 1;
}
// For bidib_state_get_board_ref
pthread_rwlock_rdlock(&bidib_state_boards_rwlock);
pthread_rwlock_rdlock(&bidib_boards_rwlock);
const t_bidib_board *const tmp_board = bidib_state_get_board_ref(board);
if (tmp_board != NULL && tmp_board->connected) {
unsigned int action_id = bidib_get_and_incr_action_id();
Expand All @@ -52,11 +52,11 @@ int bidib_ping(const char *board, uint8_t ping_byte) {
tmp_board->node_addr.top, tmp_board->node_addr.sub,
tmp_board->node_addr.subsub, action_id);
t_bidib_node_address tmp_addr = tmp_board->node_addr;
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
bidib_send_sys_ping(tmp_addr, ping_byte, action_id);
return 0;
}
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
return 1;
}

Expand All @@ -66,7 +66,7 @@ int bidib_identify(const char *board, uint8_t state) {
return 1;
}
// For bidib_state_get_board_ref
pthread_rwlock_rdlock(&bidib_state_boards_rwlock);
pthread_rwlock_rdlock(&bidib_boards_rwlock);
const t_bidib_board *const tmp_board = bidib_state_get_board_ref(board);
if (tmp_board != NULL && tmp_board->connected) {
unsigned int action_id = bidib_get_and_incr_action_id();
Expand All @@ -76,11 +76,11 @@ int bidib_identify(const char *board, uint8_t state) {
tmp_board->node_addr.top, tmp_board->node_addr.sub,
tmp_board->node_addr.subsub, action_id);
t_bidib_node_address tmp_addr = tmp_board->node_addr;
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
bidib_send_sys_identify(tmp_addr, state, action_id);
return 0;
}
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
return 1;
}

Expand All @@ -90,7 +90,7 @@ int bidib_get_protocol_version(const char *board) {
return 1;
}
// For bidib_state_get_board_ref
pthread_rwlock_rdlock(&bidib_state_boards_rwlock);
pthread_rwlock_rdlock(&bidib_boards_rwlock);
const t_bidib_board *const tmp_board = bidib_state_get_board_ref(board);
if (tmp_board != NULL && tmp_board->connected) {
unsigned int action_id = bidib_get_and_incr_action_id();
Expand All @@ -100,11 +100,11 @@ int bidib_get_protocol_version(const char *board) {
tmp_board->node_addr.top, tmp_board->node_addr.sub,
tmp_board->node_addr.subsub, action_id);
t_bidib_node_address tmp_addr = tmp_board->node_addr;
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
bidib_send_sys_get_p_version(tmp_addr, action_id);
return 0;
}
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
return 1;
}

Expand All @@ -114,7 +114,7 @@ int bidib_get_software_version(const char *board) {
return 1;
}
// For bidib_state_get_board_ref
pthread_rwlock_rdlock(&bidib_state_boards_rwlock);
pthread_rwlock_rdlock(&bidib_boards_rwlock);
const t_bidib_board *const tmp_board = bidib_state_get_board_ref(board);
if (tmp_board != NULL && tmp_board->connected) {
unsigned int action_id = bidib_get_and_incr_action_id();
Expand All @@ -124,10 +124,10 @@ int bidib_get_software_version(const char *board) {
tmp_board->node_addr.top, tmp_board->node_addr.sub,
tmp_board->node_addr.subsub, action_id);
t_bidib_node_address tmp_addr = tmp_board->node_addr;
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
bidib_send_sys_get_sw_version(tmp_addr, action_id);
return 0;
}
pthread_rwlock_unlock(&bidib_state_boards_rwlock);
pthread_rwlock_unlock(&bidib_boards_rwlock);
return 1;
}
Loading

0 comments on commit 8ea9959

Please sign in to comment.