Beispiel #1
0
 // routines for constructor use
 void set_self_ar(const char *n1, const char *n2, int os) {	// sets the name
   if (n1 == NULL) {set_self(NULL, 0); return;}
   int l1 = strlen(n1), l2 = strlen(n2);	// without using
   strcpy(longname, n1);	// tsprintf
   longname[l1] = '[';
   strcpy(longname + l1 + 1, n2);
   longname[l1 + l2 + 1] = ']';
   longname[l1 + l2 + 2] = 0;
   set_self(longname, os);
 };
BOOL CSoundFile::Destroy() {
	mpcpplog();
	if ( mod ) {
		delete mod;
		set_self( this, 0 );
	}
	return TRUE;
}
Beispiel #3
0
void ServPlayer::handle(Message* m)
{
    if (m->type() == MsgType::Attach) {
        auto msg = m->get<AttachMsg>();
        Seat* s = manager()->seat(msg->seat());
        msg->set_self(s->player() == this);
    }
    mHdler->send(new Message(*m));
}
 void mu_1_PacketRecord::set_self_ar( char *n1, char *n2, int os ) {
   int l1 = strlen(n1), l2 = strlen(n2);
   strcpy( longname, n1 );
   longname[l1] = '[';
   strcpy( longname+l1+1, n2 );
   longname[l1+l2+1] = ']';
   longname[l1+l2+2] = 0;
   set_self( longname, os );
 };
BOOL CSoundFile::Create( LPCBYTE lpStream, DWORD dwMemLength ) {
	mpcpplog();
	try {
		openmpt::module * m = new openmpt::module( lpStream, dwMemLength );
		set_self( this, m );
		std::strncpy( m_szNames[0], mod->get_metadata("title").c_str(), sizeof( m_szNames[0] ) );
		m_szNames[0][ sizeof( m_szNames[0] ) - 1 ] = '\0';
		return TRUE;
	} catch ( ... ) {
		Destroy();
		return FALSE;
	}
}
int main(int argc, const char **argv)
{
    pid_t child[_num];
    int status;

    /* fork processes */
    for (int i = 1; i <= _num; i++) {
        child[i] = fork();
        assert(-1 != child[i]);
        if (0 == child[i]) {
            set_self(i);
            init_home_qeo(i);
            run_test();
            return 0;
        }
    }
    /* wait for termination */
    for (int i = 1; i <= _num; i++) {
        assert(-1 != wait(&status));
        assert(0 == status);
    }
    return 0;
}
Beispiel #7
0
    int ObChunkServer::initialize()
    {
      int ret = OB_SUCCESS;
      // do not handle batch packet.
      // process packet one by one.
      set_batch_process(false);

      // read configure item value from configure file.
      // this step is the very first thing.
      ret = param_.load_from_config();

      // set listen port
      if (OB_SUCCESS == ret) 
      {
        ret = set_listen_port(param_.get_chunk_server_port());
      }

      if (OB_SUCCESS == ret)
      {
        ret = set_dev_name(param_.get_dev_name());
        if (OB_SUCCESS == ret)
        {
          ret = set_self(param_.get_dev_name(), 
              param_.get_chunk_server_port());
        }
      }

      // task queue and work thread count
      if (OB_SUCCESS == ret)
      {
        ret = set_default_queue_size(param_.get_task_queue_size());
      }

      if (OB_SUCCESS == ret)
      {
        ret = set_thread_count(param_.get_task_thread_count());
      }

      if (OB_SUCCESS == ret)
      {
        ret = set_min_left_time(param_.get_task_left_time());
      }

      // set packet factory object.
      if (OB_SUCCESS == ret)
      {
        ret = set_packet_factory(&packet_factory_);
      }

      // initialize client_manager_ for server remote procedure call.
      if (OB_SUCCESS == ret)
      {
        ret = client_manager_.initialize(get_transport(), get_packet_streamer());
      }

      if (OB_SUCCESS == ret)
      {
        ret = rs_rpc_stub_.init( param_.get_root_server(), &client_manager_);
      }

      if (OB_SUCCESS == ret)
      {
        ret = tablet_manager_.init(&param_);
      }

      // server initialize, including start transport, 
      // listen port, accept socket data from client
      if (OB_SUCCESS == ret)
      {
        ret = ObSingleServer::initialize();
      }

      if (OB_SUCCESS == ret)
      {
        ret = service_.initialize(this);
      }

      return ret;
    }
Beispiel #8
0
 void set_self_2(const char *n1, const char *n2, int os) {	// sets the name
   if (n1 == NULL) {set_self(NULL, 0); return;}
   strcpy(longname, n1);	// without using
   strcat(longname, n2);	// tsprintf
   set_self(longname, os);
 };
Beispiel #9
0
 // Uli: this constructor is called implicitly for function results
 //      by the code generated by the Murphi compiler
 mu__int(const mu__int & src)
 :lb(src.lb), ub(src.ub), size(src.size), in_world(FALSE) {
   set_self("Function result", 0);
   value(src.value());		// value() allows returning undefined values
 };
Beispiel #10
0
 // Uli: - seems not to be used any more
 //      - however, I left it here since it does the correct things
 mu__int(int lb, int ub, int size, int val)
 :lb(lb), ub(ub), size(size) {
   set_self("Parameter or function result", 0);
   operator=(val);
 };
Beispiel #11
0
  mu__int(int lb, int ub, int size, const char *n, int os)
 :lb(lb), ub(ub), size(size), initialized(FALSE) {
   set_self(n, os);
   undefined();
 };
    int ObMergeServer::initialize()
    {
      int ret = OB_SUCCESS;
      // disable batch process mode
      set_batch_process(false);

      if (ret == OB_SUCCESS)
      {
        // set max memory size limit
        ob_set_memory_size_limit(ms_config_.memory_size_limit_percentage
                                 * sysconf(_SC_PHYS_PAGES)
                                 * sysconf(_SC_PAGE_SIZE) / 100);
      }

      if (ret == OB_SUCCESS)
      {
        memset(&server_handler_, 0, sizeof(easy_io_handler_pt));
        server_handler_.encode = ObTbnetCallback::encode;
        server_handler_.decode = ObTbnetCallback::decode;
        server_handler_.process = ObMergeCallback::process;
        //server_handler_.batch_process
        server_handler_.get_packet_id = ObTbnetCallback::get_packet_id;
        server_handler_.on_disconnect = ObTbnetCallback::on_disconnect;
        server_handler_.user_data = this;
      }

      if (ret == OB_SUCCESS)
      {
        ret = set_listen_port((int32_t)ms_config_.port);
      }

      if (ret == OB_SUCCESS)
      {
        ret = set_dev_name(ms_config_.devname);
        if (OB_SUCCESS == ret)
        {
          ret = set_self(ms_config_.devname,
                         (int32_t)ms_config_.port);
        }
      }
      if (ret == OB_SUCCESS)
      {
        set_self_to_thread_queue(self_);
      }
      if (ret == OB_SUCCESS)
      {
        ret = init_root_server();
      }

      if (ret == OB_SUCCESS)
      {
        ret = set_default_queue_size((int32_t)ms_config_.task_queue_size);
      }

      if (ret == OB_SUCCESS)
      {
        ret = set_io_thread_count((int32_t)ms_config_.io_thread_count);
      }

      if (ret == OB_SUCCESS)
      {
        ret = set_thread_count((int32_t)ms_config_.task_thread_count);
      }

      if (ret == OB_SUCCESS)
      {
        log_interval_count_ = ms_config_.log_interval_count;
        ret = set_min_left_time(ms_config_.task_left_time);
      }

      if (ret == OB_SUCCESS)
      {
        ret = frozen_data_cache_.init(ms_config_.frozen_data_cache_size);
      }
      if (ret == OB_SUCCESS)
      {
        ret = insert_cache_.init(ms_config_.bloom_filter_cache_size);
      }
      if (ret == OB_SUCCESS)
      {
        ret = scan_req_pool_.init();
      }
      if (ret == OB_SUCCESS)
      {
        ret = get_req_pool_.init();
      }

      if (ret == OB_SUCCESS)
      {
        ret = task_timer_.init();
      }

      if (OB_SUCCESS == ret)
      {
        ret = client_manager_.initialize(eio_, &server_handler_);
      }
      if (ret == OB_SUCCESS)
      {
        ret = ObSingleServer::initialize();
      }

      if (ret == OB_SUCCESS)
      {
        ret = service_.initialize(this);
      }

      return ret;
    }
Beispiel #13
0
 ~reset_self_on_exit()
 {
     set_self(self_);
 }
Beispiel #14
0
 reset_self_on_exit(coroutine_self* self)
   : self_(self)
 {
     set_self(self->next_self_);
 }
 void mu_1_PacketRecord::set_self_2( char *n1, char *n2, int os ) {
   strcpy( longname, n1 );
   strcat( longname, n2 );
   set_self( longname, os );
 };
Beispiel #16
0
 mu__int(int lb, int ub, int size)
 :lb(lb), ub(ub), size(size), initialized(FALSE) {
   set_self(NULL, 0);
   undefined();
 };
 mu_1_PacketRecord ( char *n, int os ) { set_self(n,os); };