eventthread.cpp 1.65 KB
Newer Older
1
2
/*
 *  Copyright (C) 2004, 2005, 2006 Savoir-Faire Linux inc.
jpbl's avatar
jpbl committed
3
4
5
6
7
 *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
 *  Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com>
 *                                                                              
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 3 of the License, or
jpbl's avatar
jpbl committed
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  (at your option) any later version.
 *                                                                              
 *  This program 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 General Public License for more details.
 *                                                                              
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "eventthread.h"
22
#include "voiplink.h"
jpbl's avatar
jpbl committed
23

yanmorin's avatar
   
yanmorin committed
24
EventThread::EventThread (VoIPLink* link) : Thread () 
jpbl's avatar
jpbl committed
25
{
yanmorin's avatar
   
yanmorin committed
26
	_linkthread = link;
jpbl's avatar
jpbl committed
27
	setCancel(cancelDeferred);
Emmanuel Milou's avatar
nothing    
Emmanuel Milou committed
28
	stopIt = false;
jpbl's avatar
jpbl committed
29
30
31
32
33
34
35
36
37
38
39
40
41
}

EventThread::~EventThread (void) 
{
  terminate();
}

/**
 * Reimplementation of run() 
 */
void
EventThread::run (void) 
{
Emmanuel Milou's avatar
nothing    
Emmanuel Milou committed
42
43
  stopIt = false;
  while(!stopIt) {
yanmorin's avatar
   
yanmorin committed
44
    _linkthread->getEvent();
jpbl's avatar
jpbl committed
45
46
47
  }
}

Emmanuel Milou's avatar
nothing    
Emmanuel Milou committed
48
49
50
51
52
void
EventThread::stop( void )
{
  stopIt = true; 
}
yanmorin's avatar
yanmorin committed
53

Emmanuel Milou's avatar
nothing    
Emmanuel Milou committed
54
55
56
57
58
59
60
61
62
63
64
65
void
EventThread::startLoop( void )
{
  stopIt = false;
  //start();
}

bool
EventThread::isStopped( void )
{
  return stopIt;
}