Logo AND Algorithmique Numérique Distribuée

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