[sheepdog] [PATCH 09/11] sheep: assert when exec_req are called in the main thread

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Apr 17 05:52:47 CEST 2013


At Wed, 17 Apr 2013 11:15:08 +0800,
Liu Yuan wrote:
> 
> On 04/16/2013 03:24 PM, MORITA Kazutaka wrote:
> > @@ -509,6 +509,8 @@ int sheep_exec_req(const struct node_id *nid, struct sd_req *hdr, void *buf)
> >  	struct sockfd *sfd;
> >  	int ret;
> >  
> > +	assert(is_worker_thread());
> > +
> >  	sfd = sheep_get_sockfd(nid);
> >  	if (!sfd)
> >  		return SD_RES_NETWORK_ERROR;
> 
> Why exactly can't we call shep_exec_req in the main thread?

It is because exec_req() blocks in read/2 and write/2.  If we call it
in the main thread, sheep cannot accept any requests during the
blocking time.

Thanks,

Kazutaka



More information about the sheepdog mailing list