Ignore:
Timestamp:
Feb 23, 2013, 5:36:26 PM (9 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GnssCenter/thrift/test2/server.cpp

    r4952 r4953  
    88#include <thrift/concurrency/Thread.h>
    99#include <thrift/concurrency/PosixThreadFactory.h>
     10#include <thrift/concurrency/Mutex.h>
    1011
    1112#include "gen-cpp/myService.h"
     
    2829};
    2930
     31Mutex MUTEX;
    3032shared_ptr<t_connection> CONNECTION;
    3133
     
    3436  myProcessorFactory() {};
    3537  shared_ptr<TProcessor>   getProcessor(const TConnectionInfo& info) {
     38
     39    Guard m(MUTEX);
     40
    3641    shared_ptr<myServiceClient> client(new myServiceClient(info.output));
    3742    shared_ptr<TProcessor>      processor(new myServiceProcessor(client));
     
    7883  try {
    7984    while (true) {
    80       if (CONNECTION) {
    81         CONNECTION->_client->answer("How are you?");
     85      {
     86        Guard m(MUTEX);
     87        if (CONNECTION) {
     88          CONNECTION->_client->answer("How are you?");
     89        }
    8290      }
    8391      sleep(1);
Note: See TracChangeset for help on using the changeset viewer.