示例#1
0
CommandContainer commandContainerCreate(){
	CommandContainerInternal* m=(CommandContainerInternal*)memoryAlloc(sizeof(CommandContainerInternal));
	m->versionMap=hashmapCreate(SMALL_CONTAINER_SIZE);
        m->versions=linkedListCreate();
        m->atomicCommands=linkedListCreate();
        m->lock=lockCreate();
	return m;
}
示例#2
0
int commandExecutorProduce(CommandExecuter commandExecuter,Command command){
    CommandExecuterInternal * internal=(CommandExecuterInternal*)commandExecuter;
    int type=commandGetInt(command,COMMAND_TYPE);
     if(IS_MODEL_COMMAND(type)==TRUE){
            //noinspection SynchronizationOnLocalVariableOrMethodParameter
            Lock lock=lockCreate();
            lockLock(lock);
            coreConsume(internal->core,command);
            int status = commandGetInt(command,COMMAND_STATUS);
            if( status=VALID){
               return status;
            }
            environmentWaitObject(command,lock);
        }else{
            coreConsume(internal->core,command);
            int status = commandGetInt(command,COMMAND_STATUS);
            if( status=VALID){
               return status;
            }
        }
    return VALID;
}