Skip to content

Commit

Permalink
make apply_fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaUnisikhin committed Feb 8, 2024
1 parent 446c9bb commit a7147fd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sources/worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static inline void od_worker(void *arg)
machine_msg_t *msg;
/* Inverse priorities of cliend routing to decrease chances of timeout */
msg = machine_channel_read_random(worker->task_channel,
UINT32_MAX);
UINT32_MAX);
if (msg == NULL)
break;

Expand Down
3 changes: 2 additions & 1 deletion third_party/machinarium/sources/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ mm_msg_t *mm_channel_read_random(mm_channel_t *channel, uint32_t time_ms)

mm_list_t *next;
if ((channel->msg_list_count > 0) && (channel->readers_count == 0)) {
next = mm_list_pop_random(&channel->msg_list, channel->msg_list_count);
next = mm_list_pop_random(&channel->msg_list,
channel->msg_list_count);
channel->msg_list_count--;
mm_sleeplock_unlock(&channel->lock);
return mm_container_of(next, mm_msg_t, link);
Expand Down
2 changes: 1 addition & 1 deletion third_party/machinarium/sources/channel_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ MACHINE_API machine_msg_t *machine_channel_read_back(machine_channel_t *obj,
}

MACHINE_API machine_msg_t *machine_channel_read_random(machine_channel_t *obj,
uint32_t time_ms)
uint32_t time_ms)
{
mm_channeltype_t *type;
type = mm_cast(mm_channeltype_t *, obj);
Expand Down
6 changes: 3 additions & 3 deletions third_party/machinarium/sources/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ static inline mm_list_t *mm_list_pop_random(mm_list_t *list, int list_size)
int random_index = rand() % list_size;
register mm_list_t *pop = list->next;
for (int i = 0; i < random_index; i++) {
pop = pop->next;
}
pop = pop->next;
}
mm_list_unlink(pop);
return pop;
return pop;
}

#define mm_list_foreach(H, I) for (I = (H)->next; I != H; I = (I)->next)
Expand Down
2 changes: 1 addition & 1 deletion third_party/machinarium/sources/machinarium.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ MACHINE_API machine_msg_t *machine_channel_read_back(machine_channel_t *,
uint32_t time_ms);

MACHINE_API machine_msg_t *machine_channel_read_random(machine_channel_t *,
uint32_t time_ms);
uint32_t time_ms);

/* tls */

Expand Down

0 comments on commit a7147fd

Please sign in to comment.