(fix #121) sorry for the delay.
doc/msg-tuto-src/masterworker4
examples/msg/actions-comm/actions-comm
examples/msg/actions-storage/actions-storage
-examples/msg/async-yield/async-yield
examples/msg/async-wait/async-wait
examples/msg/async-waitall/async-waitall
examples/msg/async-waitany/async-waitany
examples/msg/process-migration/process-migration
examples/msg/process-startkilltime/process-startkilltime
examples/msg/process-suspend/process-suspend
+examples/msg/process-yield/process-yield
examples/msg/app-masterworker/app-masterworker
examples/msg/mc/bugged1
examples/msg/mc/bugged1_liveness
teshsuite/msg/process/process
teshsuite/msg/storage_client_server/storage_client_server
teshsuite/msg/task_destroy_cancel/task_destroy_cancel
+teshsuite/msg/task_listen_from/task_listen_from
teshsuite/msg/trace_integration/trace_integration
teshsuite/simdag/availability/availability
teshsuite/simdag/basic-link-test/basic-link-test
if (not comm)
return -1;
- return MSG_process_get_PID( static_cast<msg_task_t>(comm->src_data)->simdata->sender );
+ return MSG_process_get_PID(static_cast<msg_task_t>(comm->src_buff)->simdata->sender);
}
/** \ingroup msg_task_usage
endforeach()
# CPP examples
-foreach(x task_destroy_cancel)
+foreach(x task_destroy_cancel task_listen_from)
add_executable (${x} ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1-c1s1-c3s2.xml
${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp2.5-hbp1.5.xml PARENT_SCOPE)
-foreach(x get_sender host_on_off host_on_off_processes host_on_off_recv task_destroy_cancel trace_integration)
+foreach(x get_sender host_on_off host_on_off_processes host_on_off_recv task_destroy_cancel task_listen_from trace_integration)
ADD_TESH_FACTORIES(tesh-msg-${x} "thread;boost;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh)
endforeach()
--- /dev/null
+/* Copyright (c) 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. */
+
+/* This is the test case of GitHub's #121 */
+
+#include "simgrid/msg.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+
+static int tester(int argc, char* argv[])
+{
+ msg_task_t task = MSG_task_create("name", 0, 10, NULL);
+ msg_comm_t comm = MSG_task_isend(task, "mailbox");
+
+ XBT_INFO("MSG_task_listen_from returns() %d (should return my pid, which is %d)", MSG_task_listen_from("mailbox"),
+ MSG_process_get_PID(MSG_process_self()));
+ XBT_INFO("MSG_task_listen returns() %d (should return true, i.e. 1)", MSG_task_listen("mailbox"));
+
+ MSG_comm_destroy(comm);
+ MSG_task_destroy(task);
+
+ return 0;
+}
+
+int main(int argc, char* argv[])
+{
+ MSG_init(&argc, argv);
+ xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+ MSG_create_environment(argv[1]);
+
+ MSG_process_create("tester", tester, NULL, MSG_get_host_by_name("Tremblay"));
+
+ return MSG_main();
+}
--- /dev/null
+$ ./task_listen_from ${srcdir:=.}/../../../examples/platforms/small_platform.xml
+> [Tremblay:tester:(1) 0.000000] [msg_test/INFO] MSG_task_listen_from returns() 1 (should return my pid, which is 1)
+> [Tremblay:tester:(1) 0.000000] [msg_test/INFO] MSG_task_listen returns() 1 (should return true, i.e. 1)