Alexander Afanasyev | ca6f329 | 2012-04-09 10:03:30 -0700 | [diff] [blame^] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 19 | * Chaoyi Bian <bcy@pku.edu.cn> |
| 20 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 21 | */ |
| 22 | |
| 23 | #include "sync-scheduler.h" |
| 24 | #include "sync-log.h" |
| 25 | |
| 26 | #include "ns3/simulator.h" |
| 27 | |
| 28 | using namespace boost; |
| 29 | using namespace std; |
| 30 | |
| 31 | INIT_LOGGER ("Scheduler"); |
| 32 | |
| 33 | namespace Sync { |
| 34 | |
| 35 | Scheduler::Scheduler () |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | Scheduler::~Scheduler () |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | void |
| 44 | Scheduler::schedule (const boost::posix_time::time_duration &reltime, Event event, uint32_t label) |
| 45 | { |
| 46 | ns3::Seconds (reltime.total_seconds()) + ns3::MilliSeconds (reltime.milliseconds ()) + ns3::MicroSeconds (reltime.microseconds ()); |
| 47 | } |
| 48 | |
| 49 | void |
| 50 | Scheduler::cancel (uint32_t label) |
| 51 | { |
| 52 | // { |
| 53 | // // cout << "Canceling label " << label << " size: " << m_events.size () << endl; |
| 54 | // lock_guard<mutex> lock (m_eventsMutex); |
| 55 | // m_events.get<byLabel> ().erase (label); |
| 56 | // // cout << "Canceled label " << label << " size: " << m_events.size () << endl; |
| 57 | // } |
| 58 | // m_eventsCondition.notify_one (); |
| 59 | // m_thread.interrupt (); // interrupt sleep, if currently sleeping |
| 60 | } |
| 61 | |
| 62 | |
| 63 | } // Sync |