A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kill the now useless type xbt::string
[simgrid.git]
/
include
/
simgrid
/
plugins
/
ProducerConsumer.hpp
diff --git
a/include/simgrid/plugins/ProducerConsumer.hpp
b/include/simgrid/plugins/ProducerConsumer.hpp
index
f446dac
..
6f4f909
100644
(file)
--- a/
include/simgrid/plugins/ProducerConsumer.hpp
+++ b/
include/simgrid/plugins/ProducerConsumer.hpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2021
-2022
. 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 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. */
@@
-6,6
+6,7
@@
#ifndef SIMGRID_PLUGIN_PRODUCERCONSUMER_HPP
#define SIMGRID_PLUGIN_PRODUCERCONSUMER_HPP
#ifndef SIMGRID_PLUGIN_PRODUCERCONSUMER_HPP
#define SIMGRID_PLUGIN_PRODUCERCONSUMER_HPP
+#include <simgrid/s4u/Comm.hpp>
#include <simgrid/s4u/ConditionVariable.hpp>
#include <simgrid/s4u/Mailbox.hpp>
#include <simgrid/s4u/Mutex.hpp>
#include <simgrid/s4u/ConditionVariable.hpp>
#include <simgrid/s4u/Mailbox.hpp>
#include <simgrid/s4u/Mutex.hpp>
@@
-145,7
+146,9
@@
public:
while (size() >= max_queue_size_)
can_put_->wait(lock);
if (tmode_ == TransferMode::MAILBOX) {
while (size() >= max_queue_size_)
can_put_->wait(lock);
if (tmode_ == TransferMode::MAILBOX) {
- comm = mbox_->put_async(data, simulated_size_in_bytes);
+ comm = mbox_->put_init(data, simulated_size_in_bytes)
+ ->set_copy_data_callback(s4u::Comm::copy_pointer_callback)
+ ->start();
} else
queue_.push(data);
can_get_->notify_all();
} else
queue_.push(data);
can_get_->notify_all();
@@
-180,7
+183,10
@@
public:
while (empty())
can_get_->wait(lock);
if (tmode_ == TransferMode::MAILBOX)
while (empty())
can_get_->wait(lock);
if (tmode_ == TransferMode::MAILBOX)
- comm = mbox_->get_async<T>(data);
+ comm = mbox_->get_init()
+ ->set_dst_data(reinterpret_cast<void**>(data), sizeof(void*))
+ ->set_copy_data_callback(s4u::Comm::copy_pointer_callback)
+ ->start();
else {
*data = queue_.front();
queue_.pop();
else {
*data = queue_.front();
queue_.pop();
@@
-199,8
+205,7
@@
public:
T* get()
{
T* data;
T* get()
{
T* data;
- s4u::CommPtr comm = get_async(&data);
- if (comm) {
+ if (s4u::CommPtr comm = get_async(&data)) {
XBT_CDEBUG(producer_consumer, "Waiting for the data to arrive");
comm->wait();
}
XBT_CDEBUG(producer_consumer, "Waiting for the data to arrive");
comm->wait();
}