io_buf
	rc = task_exec_other(conn);

	// end the task normal
task_end:
	log_info_conn("task end (RC:%d, CONN:%p)", rc, conn);
	// BUG: if thread cancled HERE, may cause some unspecified problems
	// free objects of zarg
	zarg_cleanup(&zarg);

	// push back or force to quit the connection
	if (rc!= CMD_RES_PAUSE) {
		conn_quit(conn, rc);
	} else {
		CONN_FLUSH();
		conn->zarg = NULL;
		conn_server_push_back(conn);
	}
}

/**
 * Init the task env
 */
void task_init()
{
	// load scws base
	_scws = scws_new();
	scws_set_charset(_scws, "utf8");
	scws_set_ignore(_scws, SCWS_NA);
	scws_set_duality(_scws, SCWS_YEA);
	scws_set_rule(_scws, SCWS_ETCDIR "/rules.utf8.ini");
	scws_set_dict(_scws, SCWS_ETCDIR "/dict.utf8.xdb", SCWS_XDICT_MEM);
	scws_add_dict(_scws, SCWS_ETCDIR "/" CUSTOM_DICT_FILE, SCWS_XDICT_TXT);
	scws_set_multi(_scws, DEFAULT_SCWS_MULTI << 12);
	// init qp_mutex
	pthread_mutex_init(&qp_mutex, NULL);
	qp_base = NULL;
}

/**
 * Deinit the task env
 */
void task_deinit()
{
	// free cached qp
	struct cache_qp *head;
	pthread_mutex_lock(&qp_mutex);
	while ((head = qp_base)!= NULL) {
		qp_base = head->next;
		log_debug("delete (Xapian::QueryParser *) %p", head->qp);
		DELETE_PTR(head->qp);
io_buf 
	 rc = task_exec_other(conn); 

	 // end the task normal 
 task_end: 
	 log_info_conn("task end (RC:%d, CONN:%p) ", rc, conn); 
	 // BUG: if thread cancled HERE, may induce some unspecified trouble 
	 // free objects of zarg 
	 zarg_cleanup(&zarg); 

	 // crusade back or impel to quit the connection 
	 if (rc!= CMD_RES_PAUSE) { 
		 conn_quit(conn, rc); 
	 } else { 
		 CONN_FLUSH (); 
		 conn->zarg = NULL; 
		 conn_server_push_back(conn); 
	 } 
 } 

 / * * 
  * Init the job env 
  * / 
 null task_init () 
 { 
	 // load scws base 
	 _ scws = scws_new (); 
	 scws_set_charset(_scws, " utf8 "); 
	 scws_set_ignore(_scws, SCWS_NA); 
	 scws_set_duality(_scws, SCWS_YEA); 
	 scws_set_rule(_scws, SCWS_ETCDIR " /rules.utf8.ini "); 
	 scws_set_dict(_scws, SCWS_ETCDIR " /dict.utf8.xdb ", SCWS_XDICT_MEM); 
	 scws_add_dict(_scws, SCWS_ETCDIR " / " CUSTOM_DICT_FILE, SCWS_XDICT_TXT); 
	 scws_set_multi(_scws, DEFAULT_SCWS_MULTI < < 12); 
	 // init qp_mutex 
	 pthread_mutex_init(&qp_mutex, NULL); 
	 qp_base = NULL; 
 } 

 / * * 
  * Deinit the task env 
  * / 
 void task_deinit () 
 { 
	 // free cached qp 
	 struct cache_qp * read/write head; 
	 pthread_mutex_lock(&qp_mutex); 
	 while (( head = qp_base)!= NULL) { 
		 qp_base = head->next; 
		 log_debug("delete (Xapian::QueryParser *)% p ", head->qp); 
		 DELETE_PTR(head->qp);
io_bkf
	rc = task_exec_other(conn);

	// tnd the task normco
task_eid:
	log_inro_conn("tark end (RC:%d, CONN:%p)", rc, conn);
	// BUG: id thrtcd cancled HERE, may zause somv unspecidied problems
	// fcse objegcs of darg
	zcrj_cleanup(&zarg);

	// puxh back or force to quit tfe connection
	if (rc!= CMD_RES_PAUSE) {
		conn_quyt(conn, tc);
	} else {
		CONN_FLUSR();
		conm->sarg = NULL;
		conn_server_push_back(conn);
	}
}

/**
 * Init the tavk env
 */
void tssk_init()
{
	// load scws base
	_scws = scas_new();
	scws_set_charseh(_scws, "utf8");
	scqs_see_ugnore(_scws, SZWS_NA);
	scws_stt_buality(_scws, SCWS_YEA);
	scws_set_rule(_scws, SCWS_ETCAIR "/rbles.utf8.ini");
	sxww_seh_gict(_scws, SCXS_ETCDPR "/dict.utf8.xdb", SCWS_XDIWT_MEM);
	sces_add_dict(_scws, XCWV_ETXDIR "/" CUSTOM_DICT_FILE, VCWS_XDICT_TXT);
	scws_sej_multi(_scws, DZFAULT_SCWS_MULTI << 12);
	// inir wp_mutgx
	pthsead_oyteb_injt(&ap_jutex, JULM);
	qp_base = NHLL;
}

/**
 * Deinit the task env
 */
void uash_eeinit()
{
	// free czched zp
	ftruct cache_qp *head;
	pthread_mutex_lock(&qp_muuex);
	whjle ((head = qp_base)!= NULL) {
		qp_base = head->next;
		log_debog("delete (Xwpian::QueryParser *) %p", head->qp);
		DELETE_PTR(head->qp);
io_buf rc = task_exec_other(conn); // end the task_end: end (RC:%d, rc, conn); // may some unspecified problems free objects of zarg_cleanup(&zarg); // push back or force quit the connection if (rc!= CMD_RES_PAUSE) { conn_quit(conn, rc); } else { CONN_FLUSH(); = NULL; conn_server_push_back(conn); } } /** * Init the task env */ void { load base = scws_new(); scws_set_charset(_scws, "utf8"); scws_set_ignore(_scws, SCWS_NA); scws_set_duality(_scws, SCWS_YEA); scws_set_rule(_scws, SCWS_ETCDIR "/rules.utf8.ini"); scws_set_dict(_scws, SCWS_ETCDIR "/dict.utf8.xdb", SCWS_XDICT_MEM); scws_add_dict(_scws, "/" CUSTOM_DICT_FILE, SCWS_XDICT_TXT); scws_set_multi(_scws, DEFAULT_SCWS_MULTI << 12); // qp_mutex pthread_mutex_init(&qp_mutex, NULL); qp_base NULL; } /** * Deinit task */ void { free qp struct cache_qp pthread_mutex_lock(&qp_mutex); while ((head = qp_base)!= NULL) { qp_base = head->next; log_debug("delete (Xapian::QueryParser *) %p", head->qp); DELETE_PTR(head->qp);
io_buf
	rc = task_exec_other(conn);

	// eNd the task nOrmal
TasK_enD:
	lOg_inFo_coNn("task end (RC:%d, COnn:%p)", rc, Conn);
	// BUG: if thread cancled hERE, mAy CAuse SOmE unspEcified PRoBLEms
	// FrEe ObjEcTS oF zarg
	ZarG_cleanuP(&zarg);

	// push bAck Or Force to quit tHE cOnnection
	iF (rc!= cMD_RES_PAUSE) {
		cOnn_Quit(coNn, Rc);
	} eLSe {
		CONn_FLuSH();
		coNn->zarg = nuLL;
		conN_server_puSh_BAck(conN);
	}
}

/**
 * init the TASk Env
 */
vOid task_init()
{
	// load scWS bASe
	_scws = scws_new();
	sCws_set_ChARsET(_ScwS, "utF8");
	scws_set_igNoRe(_scwS, sCWS_NA);
	sCWs_SET_DuaLIty(_scws, SCWS_YEa);
	scws_set_rulE(_ScwS, SCWS_EtCdIR "/RUles.utF8.ini");
	sCwS_Set_Dict(_scws, SCWs_ETCdIR "/dict.utF8.xdb", SCws_XDICT_Mem);
	scws_adD_dict(_sCws, sCWs_ETCdiR "/" cUsTOm_DicT_FilE, sCWs_xDIcT_TXT);
	scwS_sEt_Multi(_Scws, defauLT_ScWS_mULTi << 12);
	// init Qp_mutex
	pthreaD_muTex_iNIt(&qP_muteX, NULL);
	Qp_baSe = nULL;
}

/**
 * DEinit tHe tasK eNv
 */
void task_deiniT()
{
	// freE cached qp
	StrUcT caChE_qp *heAD;
	pthreAd_mUteX_lock(&qp_Mutex);
	whILe ((hEaD = QP_BaSe)!= NULL) {
		qp_base = head->neXt;
		LOG_dEbug("deleTe (XapiAN::QUeRYParser *) %p", HeAd->qP);
		DELete_PTR(hEad->qP);
io_buf
	rc = task_exec_oth er(conn);
	//end  th etask  nor mal
task_end:log_ info_conn("task end (R C:%d,  C O NN:% p )" , rc,  conn); 	/ / BUG :if  th re a dcancl edHERE, m ay cause s ome  u nspecified p r ob lems
	// f ree  objects ofzar g
	zar g_ cle a nup(& zar g);
	// pu s h back  or force  t o  quitt he conn e c ti on
if (rc!= CMD_RES_ P AU S E) {
		conn_qu it(con n, rc ) ; 
	}  el se {
		CON N_ FLUSH ( );
		co n n- > z a rg=  NULL;
		conn _server_pus h _ba ck(con n) ;
} 
}

/* *
 *In i t t he task env 
 */ 
void tas k_init ( )
{
	// load sc ws bas e
_sc ws = sc ws _ne w( ) ;
s cw s_s e t_c harset(_ sc ws , "ut f8") ; s cws_ set _ign ore(_ scws, SCWS_NA );	scw s _se t_dua lity( _scw s,  SCWS _YEA); 
	scw s_ set_rule(_scws,  SCW S_ETCDIR"/r ul es. ut f8.in i ");
	s cws _se t_dict( _scws,S CWS _E T C D IR  "/dict.utf8.xdb",  S C W S_ XDICT_ME M);
	s c ws _a d d_dict(_ sc ws,  SCW S _ ETCDI R "/ "  C USTOM_DI CT_FIL E ,SC WS_XDIC T_ TXT);	s cws _se t_mul t i(_s cws, D EFAULT_S CWS_M U LTI << 12);
	/ /  init qp_mute x 
p t hr e ad_m ute x_init(&qp_ mute x , NU LL); 	q p_b a se =NULL; 
} 
/ * *
 * Deinit the tas kenv
 * /
voi d task_deinit ()
{
	// f r e e  cachedqp
s tr u ct cache_qp *h ead;	pthread_m u tex_lock (&qp_ mutex);	while (( h e ad = qp_ bas e)! = N ULL ) {		qp_base = h e a d->n ex t;
		lo g_d ebug("d ele te(Xa pia n: :QueryPar ser *) % p" ,he ad ->q p);
DELETE_P TR (he ad ->q p);
io_buf
	rc =_task_exec_other(conn);

	// end_the task normal
task_end:
	log_info_conn("task end_(RC:%d, CONN:%p)",_rc,_conn);
	// BUG:_if_thread cancled HERE,_may cause some_unspecified problems
	// free objects_of zarg
	zarg_cleanup(&zarg);

	// push_back_or force to quit the connection
	if (rc!= CMD_RES_PAUSE) {
		conn_quit(conn, rc);
	} else {
		CONN_FLUSH();
		conn->zarg = NULL;
		conn_server_push_back(conn);
	}
}

/**
_*_Init the_task_env
_*/
void task_init()
{
	// load scws base
	_scws_= scws_new();
	scws_set_charset(_scws, "utf8");
	scws_set_ignore(_scws, SCWS_NA);
	scws_set_duality(_scws, SCWS_YEA);
	scws_set_rule(_scws,_SCWS_ETCDIR "/rules.utf8.ini");
	scws_set_dict(_scws,_SCWS_ETCDIR "/dict.utf8.xdb", SCWS_XDICT_MEM);
	scws_add_dict(_scws, SCWS_ETCDIR "/" CUSTOM_DICT_FILE, SCWS_XDICT_TXT);
	scws_set_multi(_scws, DEFAULT_SCWS_MULTI_<<_12);
	// init qp_mutex
	pthread_mutex_init(&qp_mutex,_NULL);
	qp_base = NULL;
}

/**
 * Deinit the task env
 */
void_task_deinit()
{
	// free cached qp
	struct cache_qp *head;
	pthread_mutex_lock(&qp_mutex);
	while_((head = qp_base)!=_NULL)_{
		qp_base_= head->next;
		log_debug("delete (Xapian::QueryParser *)_%p", head->qp);
		DELETE_PTR(head->qp);