Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #188 from Takishipp/clean_events
[simgrid.git] / src / kernel / activity / ActivityImpl.cpp
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 #include "src/kernel/activity/ActivityImpl.hpp"
7
8 XBT_LOG_EXTERNAL_CATEGORY(simix_process);
9
10 namespace simgrid {
11 namespace kernel {
12 namespace activity {
13
14 ActivityImpl::ActivityImpl()  = default;
15 ActivityImpl::~ActivityImpl() = default;
16
17 // boost::intrusive_ptr<Activity> support:
18 void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity)
19 {
20   xbt_assert(activity->refcount_ >= 0);
21   activity->refcount_++;
22   XBT_CDEBUG(simix_process, "%p->refcount++ ~> %d", activity, (int)activity->refcount_);
23   if (XBT_LOG_ISENABLED(simix_process, xbt_log_priority_trace))
24     xbt_backtrace_display_current();
25 }
26
27 void intrusive_ptr_release(simgrid::kernel::activity::ActivityImpl* activity)
28 {
29   XBT_CDEBUG(simix_process, "%p->refcount-- ~> %d", activity, ((int)activity->refcount_) - 1);
30   xbt_assert(activity->refcount_ >= 0);
31   activity->refcount_--;
32   if (XBT_LOG_ISENABLED(simix_process, xbt_log_priority_trace))
33     xbt_backtrace_display_current();
34   if (activity->refcount_ <= 0)
35     delete activity;
36 }
37 }
38 }
39 } // namespace simgrid::kernel::activity::