| 1 | /********** |
| 2 | This library is free software; you can redistribute it and/or modify it under |
| 3 | the terms of the GNU Lesser General Public License as published by the |
| 4 | Free Software Foundation; either version 3 of the License, or (at your |
| 5 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
| 6 | |
| 7 | This library is distributed in the hope that it will be useful, but WITHOUT |
| 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
| 10 | more details. |
| 11 | |
| 12 | You should have received a copy of the GNU Lesser General Public License |
| 13 | along with this library; if not, write to the Free Software Foundation, Inc., |
| 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 15 | **********/ |
| 16 | // Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved. |
| 17 | // Usage Environment |
| 18 | // Implementation |
| 19 | |
| 20 | #include "UsageEnvironment.hh" |
| 21 | |
| 22 | Boolean UsageEnvironment::reclaim() { |
| 23 | // We delete ourselves only if we have no remainining state: |
| 24 | if (liveMediaPriv == NULL && groupsockPriv == NULL) { |
| 25 | delete this; |
| 26 | return True; |
| 27 | } |
| 28 | |
| 29 | return False; |
| 30 | } |
| 31 | |
| 32 | UsageEnvironment::UsageEnvironment(TaskScheduler& scheduler) |
| 33 | : liveMediaPriv(NULL), groupsockPriv(NULL), fScheduler(scheduler) { |
| 34 | } |
| 35 | |
| 36 | UsageEnvironment::~UsageEnvironment() { |
| 37 | } |
| 38 | |
| 39 | // By default, we handle 'should not occur'-type library errors by calling abort(). Subclasses can redefine this, if desired. |
| 40 | // (If your runtime library doesn't define the "abort()" function, then define your own (e.g., that does nothing).) |
| 41 | void UsageEnvironment::internalError() { |
| 42 | abort(); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | TaskScheduler::TaskScheduler() { |
| 47 | } |
| 48 | |
| 49 | TaskScheduler::~TaskScheduler() { |
| 50 | } |
| 51 | |
| 52 | void TaskScheduler::rescheduleDelayedTask(TaskToken& task, |
| 53 | int64_t microseconds, TaskFunc* proc, |
| 54 | void* clientData) { |
| 55 | unscheduleDelayedTask(task); |
| 56 | task = scheduleDelayedTask(microseconds, proc, clientData); |
| 57 | } |
| 58 | |
| 59 | // By default, we handle 'should not occur'-type library errors by calling abort(). Subclasses can redefine this, if desired. |
| 60 | void TaskScheduler::internalError() { |
| 61 | abort(); |
| 62 | } |
| 63 | |