Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lib/acl_threadsupport/src/acl_threadsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,15 @@ int acl_tls_set(acl_tls_key_t key, const void *data) {
void acl_set_process_affinity_mask(unsigned long long process_affinity_mask) {
cpu_set_t mask;
CPU_ZERO(&mask);
int i = 0;
// While the Linux man page for CPU_SET(3) states that the cpu argument
// is of type int, glibc changed this macro to use type size_t instead.
// https://man7.org/linux/man-pages/man3/CPU_SET.3.html
// https://sourceware.org/git/?p=glibc.git;a=commit;h=2b7e92df930b8ed1ace659bf6e0b8dff41d65bf0
size_t cpu = 0;
while (process_affinity_mask > 0) {
if (process_affinity_mask % 2)
CPU_SET(i, &mask);
i++;
CPU_SET(cpu, &mask);
cpu++;
process_affinity_mask >>= 1;
}
sched_setaffinity(0, sizeof(mask), &mask);
Expand Down Expand Up @@ -382,7 +386,7 @@ void acl_release_condvar(struct acl_condvar_s *C) {
// value otherwise.
int acl_timed_wait_condvar(struct acl_condvar_s *C, unsigned timeout_period) {
int my_entry_q;
int timed_out = 0;
unsigned int timed_out = 0;
if (!C)
return -1;

Expand Down Expand Up @@ -445,7 +449,7 @@ int acl_timed_wait_condvar(struct acl_condvar_s *C, unsigned timeout_period) {
}

// Still have the waiter mutex!
return timed_out;
return (int)timed_out;
}

// Wait on the condition variable, then release the mutex.
Expand Down