File: SocketInput.cpp

package info (click to toggle)
dasher 4.11%2Bgit20130508.adc653-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 40,248 kB
  • ctags: 5,158
  • sloc: xml: 185,479; cpp: 32,301; sh: 11,207; makefile: 828; ansic: 483
file content (38 lines) | stat: -rw-r--r-- 890 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SocketInput.cpp
//
// (C) Copyright Seb Wills 2005
//
// Linux-specific subclass of SocketInputBase: provides network socket control of Dasher cursor

#include "../Common/Common.h"

#include "SocketInput.h"
#include "SocketInputBase.h"

#include <pthread.h>

using namespace Dasher;

CSocketInput::CSocketInput(CSettingsUser *pCreator, CMessageDisplay *pMsgs)
:CSocketInputBase(pCreator, pMsgs) {
}

CSocketInput::~CSocketInput() {
  StopListening();
}

// private methods:

bool CSocketInput::LaunchReaderThread() {
  if (pthread_create(&readerThread, NULL, ThreadLauncherStub, this) == 0) {
    return true;
  } else {
    //TODO should probably pop up a Gtk error message and think about how to do i18n:
    cerr << _("Dasher socket input: failed to launch reader thread.") << endl;
    return false;
  }
}

void CSocketInput::CancelReaderThread() {
  pthread_cancel(readerThread);
}