Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use new/delete for smx_process_arg_t
[simgrid.git] / src / simix / Synchro.cpp
1 /* Copyright (c) 2007-2016. 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 #include "src/simix/Synchro.h"
7
8 simgrid::simix::Synchro::Synchro() {
9   simcalls = xbt_fifo_new();
10 }
11
12 simgrid::simix::Synchro::~Synchro() {
13   xbt_fifo_free(simcalls);
14   xbt_free(name);
15 }
16
17 void simgrid::simix::Synchro::ref()
18 {
19   refcount++;
20 }
21 void simgrid::simix::Synchro::unref()
22 {
23   xbt_assert(refcount > 0,
24       "This synchro has a negative refcount! You can only call test() or wait() once per synchronization.");
25
26   refcount--;
27   if (refcount>0)
28     return;
29   delete this;
30 }