Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
split simix::MailboxImpl to its own files
[simgrid.git] / src / simix / MailboxImpl.hpp
1 /* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMIX_MAILBOXIMPL_H
7 #define SIMIX_MAILBOXIMPL_H
8
9 #include <boost/circular_buffer.hpp>
10
11 #include "simgrid/s4u/Mailbox.hpp"
12 #include "src/simix/ActorImpl.hpp"
13
14 #define MAX_MAILBOX_SIZE 10000000
15 namespace simgrid {
16 namespace simix {
17
18 /** @brief Rendez-vous point datatype */
19
20 class MailboxImpl {
21 public:
22   MailboxImpl(const char* name)
23       : piface_(this), name_(xbt_strdup(name)), comm_queue(MAX_MAILBOX_SIZE), done_comm_queue(MAX_MAILBOX_SIZE)
24   {
25   }
26   ~MailboxImpl() { xbt_free(name_); }
27
28   simgrid::s4u::Mailbox piface_; // Our interface
29   char* name_;
30   boost::circular_buffer_space_optimized<smx_activity_t> comm_queue;
31   boost::intrusive_ptr<simgrid::simix::ActorImpl> permanent_receiver; //process which the mailbox is attached to
32   boost::circular_buffer_space_optimized<smx_activity_t> done_comm_queue;//messages already received in the permanent receive mode
33 };
34 }
35 }
36
37 XBT_PRIVATE void SIMIX_mailbox_exit();
38
39 XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char* name);
40 XBT_PRIVATE smx_mailbox_t SIMIX_mbox_get_by_name(const char* name);
41 XBT_PRIVATE void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_activity_t comm);
42 XBT_PRIVATE void SIMIX_mbox_push(smx_mailbox_t mbox, smx_activity_t synchro);
43
44 XBT_PRIVATE void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_actor_t proc);
45
46 #endif /* SIMIX_MAILBOXIMPL_H */