/**********
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)

This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
more details.

You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
**********/
// Copyright (c) 1996-2000 Live Networks, Inc.  All rights reserved.
// Usage Environment
// Implementation

#include "UsageEnvironment.hh"
#include "HashTable.hh"
void UsageEnvironment::reclaim() {
  // We delete ourselves only if we have no remainining state:
  if (liveMediaPriv == NULL && groupsockPriv == NULL) delete this;
}

void UsageEnvironment::reclaim2() {
   if (liveMediaPriv == NULL)
   {
      //   fprintf(stderr, "UsageEnvironment::reclaim(): delete (HashTable*)(liveMediaPriv);\n");

      delete (HashTable*)(liveMediaPriv);
      liveMediaPriv = NULL;
   }
   if (groupsockPriv == NULL)
   {
//      fprintf(stderr, "UsageEnvironment::reclaim(): delete (HashTable*)(groupsockPriv);\n");

      delete (HashTable*)(groupsockPriv);
      groupsockPriv = NULL;
   }    
  
   delete this;
}

UsageEnvironment::UsageEnvironment(TaskScheduler& scheduler)
  : liveMediaPriv(NULL), groupsockPriv(NULL), fScheduler(scheduler) {
}

UsageEnvironment::~UsageEnvironment() {
}

TaskScheduler::TaskScheduler() {
}

TaskScheduler::~TaskScheduler() {
}
 
void TaskScheduler::rescheduleDelayedTask(TaskToken& task,
					  int microseconds, TaskFunc* proc,
					  void* clientData) {
  unscheduleDelayedTask(task);
  task = scheduleDelayedTask(microseconds, proc, clientData);
}
