예제 #1
0
void Test_Service_Handler::open(ACE_HANDLE h, ACE_Message_Block &mb)
{
  ACE_Guard<ACE_Recursive_Thread_Mutex> guard(mtx_);

  ACE_UNUSED_ARG(mb);

  ACE_DEBUG ((LM_DEBUG, 
      ACE_TEXT("(%t) %s_Handler(%@)::open fd=%d\n"),
      is_caller_ ? "Client" : "Server" ,
      this,
      h));

  ACE_ASSERT(this->handle() == h);

  int ret = reader_.open(*this, h, 0, proactor());
  ACE_ASSERT(0 == ret);

  ret = writer_.open(*this, h, 0, proactor());
  ACE_ASSERT(0 == ret);

  // In this test we perform recv in a separate thread
  On_Open_Request *req;
  ACE_NEW_NORETURN(req, On_Open_Request(this));
  TEST_QUEUE->perform(req);
}
void AIO_Output_Handler::open
  (ACE_HANDLE new_handle, ACE_Message_Block &) {
  ACE_SOCK_Stream peer (new_handle);
  int bufsiz = ACE_DEFAULT_MAX_SOCKET_BUFSIZ;
  peer.set_option (SOL_SOCKET, SO_SNDBUF,
                   &bufsiz, sizeof bufsiz);

  reader_.open (*this, new_handle, 0, proactor ());
  writer_.open (*this, new_handle, 0, proactor ());

  ACE_Message_Block *mb = 0;
  ACE_NEW (mb, ACE_Message_Block (1));
  reader_.read (*mb, 1);
  ACE_Sig_Action no_sigpipe ((ACE_SignalHandler) SIG_IGN);
  no_sigpipe.register_action (SIGPIPE, 0);
  can_write_ = 1;
  start_write (0);
}
void AIO_Input_Handler::open
  (ACE_HANDLE new_handle, ACE_Message_Block &) {
  reader_.open (*this, new_handle, 0, proactor ());
  ACE_NEW_NORETURN
    (mblk_, ACE_Message_Block (ACE_DEFAULT_CDR_BUFSIZE));
  // Align the Message Block for a CDR stream
  ACE_CDR::mb_align (mblk_);
  reader_.read (*mblk_, LOG_HEADER_SIZE);
}
예제 #4
0
int main()
{
    Pjlib lib;
    Pj_Caching_Pool mem;
    Pj_Pool the_pool;
    Pj_Pool *pool = &the_pool;
    
    the_pool.attach(mem.create_pool(4000,4000));

    Pj_Semaphore_Lock lsem(pool);
    Pj_Semaphore_Lock *plsem;

    plsem = new(pool) Pj_Semaphore_Lock(pool);
    delete plsem;

    Pj_Proactor proactor(pool, 100, 100);

    My_Event_Handler *event_handler = new(the_pool) My_Event_Handler;
    proactor.register_socket_handler(pool, event_handler);
    proactor.unregister_handler(event_handler);

    return 0;
}