-/* Copyright (c) 2012, 2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* Returns the next element iterated by iterator it, NULL if there are no more elements */
void *xbt_dynar_iterator_next(xbt_dynar_iterator_t it)
{
- int *next;
if (it->current >= it->length) {
return NULL;
} else {
- next = xbt_dynar_get_ptr(it->indices_list, it->current);
+ int* next = xbt_dynar_get_ptr(it->indices_list, it->current);
it->current++;
return xbt_dynar_get_ptr(it->list, *next);
}
get_mailbox(node->pred_id, mailbox);
task_data_t req_data_s = xbt_new0(s_task_data_t,1);
req_data_s->type = TASK_SUCCESSOR_LEAVING;
- req_data_s->request_id = node->fingers[0].id;
req_data_s->request_id = node->pred_id;
get_mailbox(node->id, req_data_s->answer_to);
req_data_s->issuer_host_name = MSG_host_get_name(MSG_host_self());
static int server(int argc, char *argv[])
{
msg_task_t task1 = NULL, task2 = NULL;
- msg_comm_t comm_received1 = NULL, comm_received2 = NULL;
- comm_received1 = MSG_task_irecv(&task1, "mymailbox");
- comm_received2 = MSG_task_irecv(&task2, "mymailbox");
+ msg_comm_t comm_received1 = MSG_task_irecv(&task1, "mymailbox");
+ msg_comm_t comm_received2 = MSG_task_irecv(&task2, "mymailbox");
MSG_comm_wait(comm_received1, -1);
MSG_comm_wait(comm_received2, -1);
-/* Copyright (c) 2010-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
double task_comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s");
long slaves_count = xbt_str_parse_int(argv[4], "Invalid amount of slaves: %s");
- int i;
-
XBT_INFO("Got %ld slaves and %ld tasks to process", slaves_count, number_of_tasks);
- for (i = 0; i < number_of_tasks; i++) {
+ for (int i = 0; i < number_of_tasks; i++) {
char mailbox[256];
char sprintf_buffer[256];
- msg_task_t task = NULL;
snprintf(mailbox,256, "slave-%ld", i % slaves_count);
snprintf(sprintf_buffer,256, "Task_%d", i);
- task = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
+ msg_task_t task = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
if (number_of_tasks < 10000 || i % 10000 == 0)
XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name, number_of_tasks, mailbox);
}
XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
- for (i = 0; i < slaves_count; i++) {
+ for (int i = 0; i < slaves_count; i++) {
char mailbox[80];
snprintf(mailbox,80, "slave-%ld", i % slaves_count);
}
xbt_automaton_exp_label_t xbt_automaton_exp_label_new(int type, ...){
- xbt_automaton_exp_label_t label = NULL;
- label = xbt_new0(struct xbt_automaton_exp_label, 1);
+ xbt_automaton_exp_label_t label = xbt_new0(struct xbt_automaton_exp_label, 1);
label->type = type;
xbt_automaton_exp_label_t left;
xbt_automaton_exp_label_t right;
/* Initialize the default malloc descriptor. */
void *mmalloc_preinit(void)
{
- int res;
if (__mmalloc_default_mdp == NULL) {
if(!xbt_pagesize)
xbt_pagesize = getpagesize();
/* Fixme? only the default mdp in protected against forks */
// This is mandated to protect the mmalloced areas through forks. Think of tesh.
// Nah, removing the mutex isn't a good idea either for tesh
- res = xbt_os_thread_atfork(mmalloc_fork_prepare,
- mmalloc_fork_parent, mmalloc_fork_child);
+ int res = xbt_os_thread_atfork(mmalloc_fork_prepare, mmalloc_fork_parent, mmalloc_fork_child);
if (res != 0)
THROWF(system_error,0,"xbt_os_thread_atfork() failed: return value %d",res);
}