Changeset 5758 in ntrip for trunk/BNC/src/PPP


Ignore:
Timestamp:
Aug 3, 2014, 1:44:02 PM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/PPP
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP/pppClient.cpp

    r5744 r5758  
    4040 * -----------------------------------------------------------------------*/
    4141
     42#include <QThreadStorage>
    4243
    4344#include <iostream>
     
    6162using namespace std;
    6263
    63 // Global Variable
    64 //////////////////////////////////////////////////////////////////////////////
    65 t_pppClient* PPP_CLIENT = 0;
     64// Global variable holding thread-specific pointers
     65//////////////////////////////////////////////////////////////////////////////
     66QThreadStorage<t_pppClient*> CLIENTS;
     67
     68// Static function returning thread-specific pointer
     69//////////////////////////////////////////////////////////////////////////////
     70t_pppClient* t_pppClient::instance() {
     71  return CLIENTS.localData();
     72}
    6673
    6774// Constructor
     
    7683  _staRover = new t_station();
    7784  _filter   = new t_filter();
     85  CLIENTS.setLocalData(this);
    7886}
    7987
     
    8189//////////////////////////////////////////////////////////////////////////////
    8290t_pppClient::~t_pppClient() {
     91  cout << "~t_pppClient" << endl;
    8392  delete _log;
    8493  delete _opt;
  • trunk/BNC/src/PPP/pppClient.h

    r5744 r5758  
    4040  t_options*          _opt;
    4141
     42  static t_pppClient* instance();
     43
    4244 private:
    4345  void initOutput(t_output* output);
     
    6769}; // namespace BNC
    6870
    69 /// Pointer to the main object
    70 extern BNC::t_pppClient* PPP_CLIENT;
     71// Pointer to the main object (thread-specific)
     72#define PPP_CLIENT (BNC::t_pppClient::instance())
    7173
    72 /// Log stream abbreviation
     74// Log stream abbreviation
    7375#define LOG (*PPP_CLIENT->_log)
    7476
    75 /// Options abbreviation
     77// Options abbreviation
    7678#define OPT (PPP_CLIENT->_opt)
    7779
  • trunk/BNC/src/PPP/pppThread.cpp

    r5742 r5758  
    110110////////////////////////////////////////////////////////////////////////////
    111111t_pppRun::~t_pppRun() {
    112   delete _pppClient;
     112  ////  delete _pppClient;
    113113  cout << "~t_pppRun" << endl;
    114114}
Note: See TracChangeset for help on using the changeset viewer.