예제 #1
0
int all_tests(void)
{
  _run(insert_item_test);
  _run(remove_item_test);

  return 0;
}
예제 #2
0
void RLRequest::run()
{
    if(name=="multi"){
        _run();
        return;
    }
    if(name=="exec"||name=="discard"){

#ifdef DEBUG
        printf("Subrequest Number in this Transaction:%ld\n",
               connection->transaction->subrequest.size());
#endif

        if(connection->transaction){
            _run();
        }else{
            connection->write_error("ERR EXEC/DISCARD without MULTI");
        }
        return;
    }

    if(connection->transaction){
        connection->transaction->subrequest.push_back(this);
        connection->current_request=NULL;
        connection->write_status("QUEUED");
    }else{
        _run();
    }
}
예제 #3
0
int ihome_command_init(output_fun_t output)
{
#define _run(fun) do{ if(fun != 0) return -1; } while(0)
	_run(command_init(&ihome_command_head));
	command_set_output(ihome_command_head, output, NULL);
	_run(ihome_command_install());
	return 0;
#undef _run
}
예제 #4
0
int all_tests(void)
{
  _run(move_south_test);
  _run(move_east_test);
  _run(move_west_test);
  _run(move_north_test);
  _run(move_northwest_test);
  return 0;
}
예제 #5
0
파일: moduletree.c 프로젝트: errord/sirius
static modulenode_t *_run(moduletree_t *modtree, modulenode_t *modnode)
{
	int next = 1;
	modulenode_t **child;
	int i;
	switch (modnode->type) {
	case MNTYPE_HEAD:
	case MNTYPE_MODULE:
		module_process(modnode);
		break;

	case MNTYPE_FILTER:
		filter_process(modnode);
		break;

	case MNTYPE_MERGER:
		if (!allset(modnode)) {
			next = 0;
			break;
		}
		merge_process(modnode);
		break;
	}
	if (next == 1) {
		for (i = 0; i < modnode->childsize; ++i) {
			_run(modtree, modnode->child[i]);
		}
	}
}
void TransientAreasSegmentationModuleImpl::run(InputArray inputToProcess, const int channelIndex)
{
    cv::Mat inputToSegment=inputToProcess.getMat();
    // preliminary basic error check
    if ( (inputToSegment.rows*inputToSegment.cols) != (int)_inputToSegment.size())
    {
    	std::stringstream errorMsg;
    	errorMsg<<"Input matrix size does not match instance buffers setup !"
    			<<"\n\t Input size is : "<<inputToSegment.rows*inputToSegment.cols
    			<<"\n\t v.s. internalBuffer size is : "<<  _inputToSegment.size();
    	throw cv::Exception(-1, errorMsg.str().c_str(), "SegmentationModule::run", "SegmentationModule.cpp", 0);
    }
    if (channelIndex >= inputToSegment.channels())
    {
    	std::stringstream errorMsg;
    	errorMsg<<"Cannot access channel index "<<channelIndex<<" on the input matrix with channels quantity = "<<inputToSegment.channels();
    	throw cv::Exception(-1, errorMsg.str().c_str(), "SegmentationModule::run", "SegmentationModule.cpp", 0);
    }

    // create a cv::Mat header for the input valarray
    // convert to float AND fill the valarray buffer
    typedef float T; // define here the target pixel format, here, float
    const int dsttype = cv::DataType<T>::depth; // output buffer is float format
    cv::Mat dst(inputToSegment.size(), dsttype, &_inputToSegment[0]);
    inputToSegment.convertTo(dst, dsttype);
    //cv::imshow("Mask",dst);
    //cv::waitKey();
    // call the low level method
    _run(_inputToSegment, channelIndex);
}
trex_rpc_cmd_rc_e
TrexRpcCommand::run(const Json::Value &params, Json::Value &result) {
    trex_rpc_cmd_rc_e rc;

    /* the internal run can throw a parser error / other error */
    try {

        /* verify API handler is correct (version mismatch) */
        if ( (m_api_type != APIClass::API_CLASS_TYPE_NO_API) && !g_test_override_api ) {
            verify_api_handler(params, result);
        }

        /* verify ownership */
        if (m_needs_ownership && !g_test_override_ownership) {
            verify_ownership(params, result);
        }

        check_param_count(params, m_param_count, result);

        /* run the command itself*/
        rc = _run(params, result);

    } catch (TrexRpcCommandException &e) {
        return e.get_rc();
    }

    return (rc);
}
예제 #8
0
	//-----------------------------------------------------------------------
	void UnicodeFileSystemArchive::FileFinder::run(const WString& _wpattern, bool _recursive, bool _dirs,
			StringVector* _simpleList, FileInfoList* _detailList)
	{
		mRecursive = _recursive;
		mDirs = _dirs;
		mSimpleList = _simpleList;
		mDetailList = _detailList;

		// pattern can contain a directory name, separate it from mask
        size_t pos1 = _wpattern.rfind ('/');
        size_t pos2 = _wpattern.rfind ('\\');
        if (pos1 == _wpattern.npos || ((pos2 != _wpattern.npos) && (pos1 < pos2)))
            pos1 = pos2;

		WString wdir, wmask;
		if(pos1 == String::npos)
		{
			wmask = _wpattern;
		}
		else
		{
			wdir = _wpattern.substr(0, pos1 + 1);
			wmask = _wpattern.substr(pos1 + 1);
		}

		if(wmask == L"*")
			wmask.clear();

		String mask = mArchive->toString(wmask);
		String dir = mArchive->toString(wdir);
		WString wFullDir = mArchive->getFullPath(wdir);

		_run(dir, wFullDir);
	}
예제 #9
0
파일: rvp.cpp 프로젝트: glycerine/shore-mt
w_rc_t rvp_t::run()
{
    w_rc_t e = _run();
    notify_partitions();
    giveback();
    return (e);
}
예제 #10
0
static void
_run (void (*hook) (const struct trie_node_s *), struct trie_node_s **p)
{
	for (; *p ;++p) {
		if ((*p)->u) hook (*p);
		if ((*p)->next) _run (hook, (*p)->next);
	}
}
예제 #11
0
bool greedy::run(Model& m,std::vector<Node*>& solution){        
    begin();

    isSolved = _run(m,solution);
    
    end();    
    return isSolved;    
}
예제 #12
0
파일: moduletree.c 프로젝트: errord/sirius
void modtree_run(moduletree_t *modtree)
{
	modulenode_t head;
	modulenode_t *tail;
	_setheadnode(modtree, &head);
	tail = _run(modtree, modtree->root);
	_freeheadnode(&head);
	modtree->out = tail->out;
}
예제 #13
0
 virtual bool run(OperationContext* txn, const string& a, BSONObj& b, int e, string& errmsg, BSONObjBuilder& c, bool d) {
     try {
         rwlock_try_write lk(mutex);
         return _run(txn, a,b,e,errmsg,c,d);
     }
     catch(rwlock_try_write::exception&) { }
     errmsg = "a replSetReconfig is already in progress";
     return false;
 }
예제 #14
0
    void AsyncTask::run()
    {
        _prerun();
        log::messageln("AsyncTask::run %d - %s", getObjectID(), typeid(*this).name());

        OX_ASSERT(_status == status_not_started);
        _status = status_inprogress;
        if (!syncEvent(runID))
            _run();
    }
예제 #15
0
        void Transition::run(Flow* f, spScene current, spScene next, bool back)
        {
            _flow = f;
            _current = current;
            _next = next;
            _done = false;

            _attach(current, next, back);
            _run(current, next, back);
        }
 void run() {
     _run( 123, 456 );
     _run( 0xdeadbeef, 0xcafecafe );
     _run( 0, 0 );
     _run( 99999999, 999 );
     _run( 0xFFFFFFFF, 1 );
     _run( 0xFFFFFFFF, 0 );
     _run( 0xFFFFFFFF, 0xFFFFFFFF );
 }
예제 #17
0
파일: testing.c 프로젝트: wingyplus/testlar
int _t_run(test_t tests[], int len) {
  int i;
  int ret;

  for (i = 0; i < len; i++) {
    if ((ret = _run(&tests[i])) != 0) {
      return ret;
    }
  }

  return 0;
}
예제 #18
0
static void *
_schedule(void *arg) {
    struct scheduler *s = arg;
    _set_scheduler(s);
    for (;;) {
        assert(_running_coroutine() == NULL);
        struct coroutine *co = _next_coroutine(s);
        assert(co->sched == s);
        _run(co);
    }
    return NULL;
}
예제 #19
0
INT32 migExport::run( INT32 &total )
{
   INT32 rc = SDB_OK ;
   rc = _run( _pMigArg->pCSName, _pMigArg->pCLName, total ) ;
   if ( rc )
   {
      goto error ;
   }
done:
   return rc ;
error:
   goto done ;
}
예제 #20
0
Future<void> OplogApplier::startup() {
    auto pf = makePromiseFuture<void>();
    auto callback =
        [ this, promise = pf.promise.share() ](const CallbackArgs& args) mutable noexcept {
        invariant(args.status);
        log() << "Starting oplog application";
        _run(_oplogBuffer);
        log() << "Finished oplog application";
        promise.setWith([] {});
    };
    invariant(_executor->scheduleWork(callback).getStatus());
    return std::move(pf.future);
}
예제 #21
0
파일: fork.cpp 프로젝트: kehusa/ThingML
void* /*NAME*/_proc(void * p)
{
  // Get parameters from the main thread
  struct /*NAME*/_struct params = *((struct /*NAME*/_struct *) p);
  
  // Unblock the main thread
  pthread_mutex_lock(params.lock);
  pthread_cond_signal(params.cv);
  pthread_mutex_unlock(params.lock);
  
  // Run the function
  ///*NAME*/_run(params._instance, params.esums_device);
  /*NAME*/_run(/*ACTUAL_PARAMS*/);
}
예제 #22
0
   INT32 cPmdDaemon::run( INT32 argc, CHAR **argv, BOOLEAN asProc )
   {
      INT32 rc = SDB_OK ;

#if defined (_WINDOWS)
      if ( asProc )
      {
         rc = _run( argc, argv ) ;
      }
      else
      {
         rc = pmdWinstartService( _procName, &cPmdDaemon::_run ) ;
      }
#elif defined (_LINUX)
      ossEnableNameChanges ( argc, argv ) ;
      ossRenameProcess ( _procName ) ;
      rc = _run( argc, argv ) ;
#endif
      PD_RC_CHECK( rc, PDERROR, "Failed to start the service(rc=%d)", rc ) ;
   done:
      return rc;
   error:
      goto done;
   }
void BrpcCtrlInterface::run()
{
    if (! sipDispatcher) {
        ERROR("SIP dispatcher hook not set.\n");
        return;
    }

    if (! initCallbacks()) {
        ERROR("failed to init BINRPC call back system\n");
        return;
    }

    if(rpcCheck())
        serResync();

    _run();
}
예제 #24
0
/**
 * Interrupt 80h. Handles the system calls.
 *
 *  @param regs Pointer to struct containing micro's registers.
 */
void int80(registers* regs) {

    switch (regs->eax) {

        case _SYS_READ:
            regs->eax = _read((unsigned int)regs->ebx, (char*)regs->ecx, (size_t)regs->edx);
            break;
        case _SYS_WRITE:
            regs->eax = _write((unsigned int)regs->ebx, (const char*)regs->ecx, (size_t)regs->edx);
            break;
        case _SYS_TIME:
            regs->eax = _time(regs->ebx);
            break;
        case _SYS_IOCTL:
            regs->eax = _ioctl(regs->ebx, regs->ecx, (void*)regs->edx);
            break;
        case _SYS_TICKS:
            regs->eax = _getTicksSinceStart();
            break;
        case _SYS_YIELD:
            // This just makes sure we call the scheduler again, for now
            break;
        case _SYS_EXIT:
            _exit();
            break;
        case _SYS_GETPID:
            regs->eax = _getpid();
            break;
        case _SYS_GETPPID:
            regs->eax = _getppid();
            break;
        case _SYS_RUN:
            regs->eax = _run((void(*)(char*)) regs->ebx, (char*) regs->ecx, regs->edx);
            break;
        case _SYS_WAIT:
            regs->eax = _wait();
            break;
        case _SYS_KILL:
            _kill((pid_t) regs->ebx);
            break;
        case _SYS_PINFO:
            regs->eax = _pinfo(regs->ebx, (size_t)regs->ecx);
            break;
    }
}
예제 #25
0
trex_rpc_cmd_rc_e 
TrexRpcCommand::run(const Json::Value &params, Json::Value &result) {
    trex_rpc_cmd_rc_e rc;

    /* the internal run can throw a parser error / other error */
    try {

        check_param_count(params, m_param_count, result);

        if (m_needs_ownership && !g_test_override_ownership) {
            verify_ownership(params, result);
        }

        /* run the command itself*/
        rc = _run(params, result);

    } catch (TrexRpcCommandException &e) {
        return e.get_rc();
    }

    return (rc);
}
예제 #26
0
 void AsyncTask::_threadCB(const ThreadDispatcher::message& msg)
 {
     switch (msg.msgid)
     {
         case successID:
             _complete();
             break;
         case errorID:
             _error();
             break;
         case runID:
             _run();
             break;
         case customID:
             _custom(msg);
             break;
         default:
             break;
     }
     if (msg.msgid != customID)
         releaseRef();
 }
예제 #27
0
pid_t Runnable::run(){
    // esto se asegura que al crear un runnable se inicializan sus estructuras
    /// podemos asumir que no existe un archivo con el nombre 'runnableTempLockFile' (sino cambiar, pq al final lo borro)
    LockFile lock("runnableTempLockFile");
    lock.tomarLock();
    this->init();
    lock.liberarLock();
    unlink("runnableTempLockFile");

    pid_t pid = fork();
    if(pid == -1){
        child = false;
        perror("Runnable error: ");
    }

    // en el hijo corro la funcion _run y termino
    if(pid == 0){
        _run();
        exit(0);
    } else {
        return pid;
    }
    // en el padre sigo como si nada
}
예제 #28
0
INT32 migExport::_run( const CHAR *pCSName, const CHAR *pCLName, INT32 &total )
{
   INT32 rc = SDB_OK ;
   const CHAR *pTemp = NULL ;
   bson obj ;
   bson_iterator it ;
   bson_type type ;

   bson_init( &obj ) ;
   if ( ( pCSName == NULL && pCLName == NULL ) ||
        ( pCSName == NULL && pCLName != NULL ) )
   {
      //never cs cl
      rc = _getCSList() ;
      if ( rc )
      {
         PD_LOG ( PDERROR, "Failed to get collection space list, rc = %d",
                  rc ) ;
         goto error ;
      }
      while( TRUE )
      {
         rc = sdbNext( _gCSList, &obj ) ;
         if ( rc )
         {
            if ( SDB_DMS_EOC != rc )
            {
               PD_LOG ( PDERROR, "Failed to get collection space list, rc = %d",
                        rc ) ;
               goto error ;
            }
            else
            {
               rc = SDB_OK ;
               goto done ;
            }
         }
         type = bson_find( &it, &obj, "Name" ) ;
         if ( type != BSON_STRING )
         {
            rc = SDB_SYS ;
            PD_LOG ( PDERROR, "List collection space does not string, rc = %d",
                     rc ) ;
            goto error ;
         }
         pTemp = bson_iterator_string( &it ) ;
         rc = _run( pTemp, pCLName, total ) ;
         if ( rc )
         {
            PD_LOG ( PDERROR, "Faild to call _run, rc = %d", rc ) ;
            goto error ;
         }
      }
   }
   else if ( pCSName != NULL && pCLName == NULL )
   {
      //cs
      rc = _getCLList() ;
      if ( rc )
      {
         PD_LOG ( PDERROR, "Failed to get collection list, rc = %d",
                  rc ) ;
         goto error ;
      }
      while ( TRUE )
      {
         rc = sdbNext( _gCLList, &obj ) ;
         if ( rc )
         {
            if ( SDB_DMS_EOC != rc )
            {
               PD_LOG ( PDERROR, "Failed to get collection list, rc = %d",
                        rc ) ;
               goto error ;
            }
            else
            {
               rc = SDB_OK ;
               goto done ;
            }
         }
         type = bson_find( &it, &obj, "Name" ) ;
         if ( type != BSON_STRING )
         {
            rc = SDB_SYS ;
            PD_LOG ( PDERROR, "List collection does not string, rc = %d",
                     rc ) ;
            goto error ;
         }
         pTemp = bson_iterator_string( &it ) ;
         rc = _run( pCSName, pTemp, total ) ;
         if ( rc )
         {
            PD_LOG ( PDERROR, "Faild to call _run, rc = %d", rc ) ;
            goto error ;
         }
      }
   }
   else
   {
      //cs and cl
      rc = _exportCL( pCSName, pCLName, total ) ;
      if ( rc )
      {
         PD_LOG ( PDERROR, "Faild to call _export, rc = %d", rc ) ;
         goto error ;
      }
   }
done:
   bson_destroy ( &obj ) ;
   return rc ;
error:
   goto done ;
}
예제 #29
0
	//-----------------------------------------------------------------------
	void UnicodeFileSystemArchive::FileFinder::_run(const String& _dir, const WString& _wFullDir)
	{
		wchar_t wFindPattern[MAX_PATH];
		wcscpy(wFindPattern, _wFullDir.c_str());
		wcscpy(&wFindPattern[_wFullDir.length()], L"*");
       
        long lHandle;
		struct _wfinddata_t wTagData;
        lHandle = _wfindfirst(wFindPattern, &wTagData);

		String  tagDataName;
		String  dir2;
		WString wFullDir2;

		while(lHandle != -1)
		{
			bool isSubDir = ((wTagData.attrib & _A_SUBDIR) != 0);
			bool isHidden = ((wTagData.attrib & _A_HIDDEN) != 0);
			if((!mIgnoreHidden || !isHidden)
				&& !isReservedDir(wTagData.name)
				&& ((isSubDir == mDirs) || (isSubDir && mRecursive)))
			{
				tagDataName = mArchive->toString(wTagData.name);

				if(isSubDir == mDirs
					&& (mMask.empty() || StrUtil::match(tagDataName, mMask)))
				{
					if (mSimpleList)
					{
						mSimpleList->push_back(String());
						String& back = mSimpleList->back();
						back = _dir;
						back += tagDataName;
					}
					else if (mDetailList)
					{
						FileInfo fi;
						fi.archive = mArchive;
						fi.filename = _dir;
						fi.filename += tagDataName;
						fi.basename = tagDataName;
						fi.path = _dir;
						fi.compressedSize = wTagData.size;
						fi.uncompressedSize = wTagData.size;
						mDetailList->push_back(fi);
					}
				}

				if(isSubDir && mRecursive)
				{
					dir2 = _dir;
					dir2 += tagDataName;
					dir2 += '/';
					
					wFullDir2 = _wFullDir;
					wFullDir2 += wTagData.name;
					wFullDir2 += '/';
					
					_run(dir2, wFullDir2);
				}
			}
			
			if(_wfindnext( lHandle, &wTagData ) == -1)
			{
				_findclose(lHandle);
				lHandle = -1;
			}
        }
    }
예제 #30
0
void
path_parser_foreach (struct path_parser_s *self,
		void (*hook) (const struct trie_node_s *))
{
	if (self->roots) _run (hook, self->roots);
}