コード例 #1
0
ファイル: get_mul_copy.c プロジェクト: Mityuha/gspp
int main(int argc, char** argv)
{
        const int minp = 2 ;
        const int dinp = 0 ;
	strcpy(myname, name) ;
        if( minp )
        {
                std::map<int, std::vector<int> > tagbufs ;
                while(1)
                {
                        std::vector<int> inputs = get_inputs(minp, dinp, tagbufs) ;
			//input0
                        int inp0 ;
                        int inp0buf = inputs[0] ;
                        pvm_setrbuf(inp0buf) ;
                        pvm_upkint(&inp0, 1 ,1 ) ;
			pvm_freebuf(inp0buf) ;
			//input1
                        int inp1 ;
                        int inp1buf = inputs[1] ;
                        pvm_setrbuf(inp1buf) ;
                        pvm_upkint(&inp1, 1 ,1 ) ;
			pvm_freebuf(inp1buf) ;
			get_mul(inp0, inp1) ;
                }
        }
        return 0 ;
}
コード例 #2
0
ファイル: gen_x_copy.c プロジェクト: Mityuha/gspp
int main(int argc, char** argv)
{
        const int minp = 1 ;
        const int dinp = 0 ;
	strcpy(myname, name) ;
	mytid = pvm_mytid() ;
	printf("[gen_x_copy]: hello!\n") ;
        //просто запускаем функцию и выходим.
        if( minp )
        {
                std::map<int, std::vector<int> > tagbufs ;
                while(1)
                {
			printf("[gen_x_copy]:waiting for inputs\n") ;
                        std::vector<int> inputs = get_inputs(minp, dinp, tagbufs) ;
			printf("[gen_x_copy]:inputs are receiving\n") ;
			int inp0 ;
			int inp0buf = inputs[0] ;
			printf("[gen_x_copy]:inp0buf=%d\n", inp0buf) ;
			pvm_setrbuf(inp0buf) ;
			pvm_upkint(&inp0, 1 ,1 ) ;
			printf("[gen_x_copy]:after unpack inp0=%d\n", inp0) ;
			gen_x(inp0) ;
			pvm_freebuf(inp0buf) ;
                }
        }
        return 0 ;
}
コード例 #3
0
ファイル: bbsdirect.cpp プロジェクト: stephanmg/neuron
void BBSDirect::return_args(int userid) {
#if defined(HAVE_STL)
	KeepArgs::iterator i = keepargs_->find(userid);
	if (i != keepargs_->end()) {
		int bufid = (*i).second;
		keepargs_->erase(i);
		pvm_freebuf(pvm_setrbuf(bufid));
		BBSImpl::return_args(userid);
	}
#endif
}
コード例 #4
0
ファイル: bbslsrv2.cpp プロジェクト: stephanmg/neuron
int BBSDirectServer::look_take_todo() {
#if defined(HAVE_STL)
	ReadyList::iterator i = todo_->begin();
	if (i != todo_->end()) {
		WorkItem* w = (WorkItem*)(*i);
		todo_->erase(i);
		int oldbuf = pvm_setrbuf(w->bufid_);
		pvm_freebuf(oldbuf);
		w->bufid_ = 0;
		return w->id_;
	}else{
		return 0;
	}
#else
return 0;
#endif
}
コード例 #5
0
ファイル: bbslsrv2.cpp プロジェクト: stephanmg/neuron
bool BBSDirectServer::look(const char* key) {
	bool b = false;
#if defined(HAVE_STL)
	MessageList::iterator m = messages_->find(key);
	if (m != messages_->end()) {
		b = true;
		int buf  = (*m).second;
		pvm_initsend(PvmDataDefault);
		pvm_pkmesgbody(buf);
		buf = pvm_getrbuf();
		pvm_setrbuf(pvm_setsbuf(pvm_mkbuf(PvmDataDefault)));
		pvm_freebuf(buf);
	}
//	printf("DirectServer::look %d |%s|\n", b, key);
#endif
	return b;
}
コード例 #6
0
ファイル: bbslsrv2.cpp プロジェクト: stephanmg/neuron
int BBSDirectServer::look_take_result(int pid) {
#if defined(HAVE_STL)
	ResultList::iterator i = results_->find(pid);
	if (i != results_->end()) {
		WorkItem* w = (WorkItem*)((*i).second);
		results_->erase(i);
		int oldbuf = pvm_setrbuf(w->bufid_);
		pvm_freebuf(oldbuf);
		int id = w->id_;
		WorkList::iterator j = work_->find(id);
		work_->erase(j);
		delete w;
		return id;
	}else{
		return 0;
	}	
#else
return 0;
#endif
}
コード例 #7
0
ファイル: bbslsrv2.cpp プロジェクト: stephanmg/neuron
bool BBSDirectServer::look_take(const char* key) {
	bool b = false;
#if defined(HAVE_STL)
	MessageList::iterator m = messages_->find(key);
	if (m != messages_->end()) {
		b = true;
		int buf = (*m).second;
		buf = pvm_setrbuf(buf);
//printf("free %d\n", buf);
		pvm_freebuf(buf);
		char* s = (char*)((*m).first);
		messages_->erase(m);
		delete [] s;
	}
#if debug
	if (b) {
		printf("DirectServer::look_take |%s| %d\n", key, pvm_getrbuf());
	}else{
		printf("DirectServer::look_take |%s| fail\n", key);
	}
#endif
#endif
	return b;
}
コード例 #8
0
ファイル: proccomm.c プロジェクト: e2bsq/Symphony
void setrbuf(int rbufid)
{
   int info;
      
   PVM_FUNC(info, pvm_setrbuf(rbufid));
}