Ejemplo n.º 1
0
   virtual void go()
   {
      LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);

      for (int i = 0; i < max_count; ++i)
      {
         UInt32 chid = allocChannel(ePlainData, this);
         closeChannel(chid);
      }
   }
Ejemplo n.º 2
0
   virtual void go()
   {
      LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);

      for (int i = 0; i < max_count; ++i)
      {
         UInt32 chid = allocChannel(ePlainData, this);
         sync_test("MultipleOpenCloseTest alloc sync");
         closeChannel(chid);
         sync_test("MultipleOpenCloseTest close sync");
      }
   }
Ejemplo n.º 3
0
   static void job(IThreadPoolJobData const* pData)
   {
      struct Observer : public IChannelObserver
      {
         virtual void dataReceivedCallback(const UInt32 channel_id, const UInt32 read_size)//, const UInt32 free_size)
         {
            LOG4CPLUS_TRACE(msLogger, std::string("Observer::bufferOverflowCallback ") + 
               "channel_id = " + convertIntegerToString(channel_id) +
               "read_size = "  + convertIntegerToString(read_size));// +
//               "free_size = "  + convertIntegerToString(free_size));
         }

         virtual void bufferOverflowCallback(const UInt32 channel_id)
         {
            LOG4CPLUS_TRACE(msLogger, "Observer::bufferOverflowCallback channel_id = " + convertIntegerToString(channel_id));
         }

         virtual void channelDeletedCallback(const UInt32 channel_id)
         {
            LOG4CPLUS_TRACE(msLogger, "Observer::channelDeletedCallback channel_id = " + convertIntegerToString(channel_id));
         }

         virtual void connectionLostCallback()
         {
            LOG4CPLUS_TRACE(msLogger, "Observer::connectionLostCallback");
         }
      };
      Observer obs;

      LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);

      JobBarrierData const* jdb = static_cast<JobBarrierData const*>(pData);

      LOG4CPLUS_INFO(msLogger, "job begin, waiting");
      int res = pthread_barrier_wait(jdb->pBar);

      LOG4CPLUS_INFO(msLogger, "job wait done, allocating");

      UInt32 chid = allocChannel(ePlainData, &obs);
      closeChannel(chid);

      LOG4CPLUS_INFO(msLogger, "job close done, waiting");
      res = pthread_barrier_wait(jdb->pBar);
      if (res == PTHREAD_BARRIER_SERIAL_THREAD)
      {
         jdb->pSem->signal();
         LOG4CPLUS_INFO(msLogger, "signaling to main thread");
      }
      LOG4CPLUS_INFO(msLogger, "job done, waiting");

   }
Ejemplo n.º 4
0
   virtual void go()
   {
      LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);

      for (int i = 0; i < max_count; ++i)
      {
         UInt32 chid = allocChannel(ePlainData, this);
         //sync_test("DataLostAfterChannelAlloc alloc sync");

         int sem_res = data_sem.waitTimeout(timeout);
         assert(0 == sem_res && "data lost, sem exited by timeout");

         sync_test("DataLostAfterChannelAlloc data sync");

         closeChannel(chid);
         sync_test("DataLostAfterChannelAlloc close sync");
      }
   }
Ejemplo n.º 5
0
   virtual void go()
   {
      LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);

      UInt8 data[1] = { 42 };

      for (int i = 0; i < max_count; ++i)
      {
         UInt32 chid = allocChannel(ePlainData, this);
         //sync_test("DataLostAfterChannelAlloc alloc sync");

         ERROR_CODE err = sendData(chid, data, 1);
         assert(ERR_OK == err && "sendData error");
         // if (ERR_OK != err)
         // {
         //    LOG4CPLUS_WARN(msLogger, "sendData err = " + covertIntegerToString((int)err));
         // }

         sync_test("DataLostAfterChannelAlloc data sync");

         closeChannel(chid);
         sync_test("DataLostAfterChannelAlloc close sync");
      }
   }