Example #1
0
void *patching(void *t){
	/**************
	* 변수 설정
	*************/
	int status;/*{{{*/
	char *buf;
	struct ipq_handle *h;
	packet_ctx *ctx;
	h = (struct ipq_handle *)t;

/*}}}*/
	while(1){
		ctx = (packet_ctx *)malloc(sizeof(packet_ctx));
		ctx->buf=(char *)malloc(sizeof(char) * BUFSIZE);
		ctx->status= ipq_read(h,ctx->buf,BUFSIZE,0);
		if(ctx->status < 0){
			dlog(0,"err!\n");
			die(h);
		}
		ctx->h = h;
		dlog(0,"buffer size :%d\n",ReadyQueue.currentSize);
		
		if(ReadyQueue.currentSize<30){
			pthread_mutex_lock(&queueLock);
			safe_queue(&ReadyQueue,ctx);
			pthread_mutex_unlock(&queueLock);		
		}
		else{
					dlog(0,stderr,"sleep 1 second\n");
					sleep(1);
		}

	}

}
Example #2
0
 void axiom(VD axiom, Cost const& c = PT::start(), ED h = ED()) {
   SHOWIF2(TUHG, 3, c, axiom, TUHG_PRINT(axiom, g));
   Cost& mc = mu[axiom];
   if (PT::update(c, mc)) {
     assert(PT::includes(c, mc));
     safe_queue(axiom);
     if (pi) put(pi, axiom, h);
   } else {
     SHOWIF4(TUHG, 0, "WARNING: axiom didn't improve mu[axiom]", c, axiom, mu[axiom], TUHG_PRINT(axiom, g));
   }
 }