您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ synchronized函数代码示例

51自学网 2021-06-03 08:36:43
  C++
这篇教程C++ synchronized函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中synchronized函数的典型用法代码示例。如果您正苦于以下问题:C++ synchronized函数的具体用法?C++ synchronized怎么用?C++ synchronized使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了synchronized函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: synchronized

void CThreadQueue::processCommandBase(IQueueCommand* pCmd){    {        synchronized(m_mxStackCommands);        m_pCurCmd = pCmd;    }    processCommand(pCmd);    {        synchronized(m_mxStackCommands);        m_pCurCmd = null;    }}
开发者ID:Aerodynamic,项目名称:rhodes,代码行数:14,


示例2: throw

//// getOutputStream()//OutputStream* Socket::getOutputStream()    throw(IOException){    if (! isConnected())    {        throw IOException("Socket not connected");    }    OutputStream* stream = NULL;    try    {        Synchronized synchronized(_sync);        {            stream = _impl->getOutputStream();            // If this socket has an associated channel then the resulting            // output stream delegates all of its operations to the channel.            // If the channel is in non-blocking mode then the output stream's            // write operations will throw an IllegalBlockingModeException            stream->_channel = _channel;        }    }    catch(TIDThr::Exception& e)    {        throw IOException(e.what());    }    return stream;}
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:33,


示例3: throw

//// read()//ssize_t SocketChannel::read(unsigned char* dst, size_t dst_len)    throw (NotYetConnectedException, IOException){    // Comprueba si esta conectado    if (! isConnected())    {        throw NotYetConnectedException("Channel not connected");    }    // Comprueba si el extremo de lectura esta cerrado    if (_socket->isInputShutdown())    {        return -1;    }    // Obtiene el stream de entrada del socket    try    {        Synchronized synchronized(_sync);        {            if (_istream == NULL)            {                _istream = _socket->getInputStream();            }        }    }    catch(TIDThr::Exception& e)    {        throw IOException(e.what());    }    return _istream->read(dst, dst_len);}
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:36,


示例4: throw

//// connect()//void DatagramSocket::connect(const SocketAddress& addr,const char* interface)    throw(SocketException, IllegalArgumentException){    // Comprueba si addr es referencia a un objeto InetSocketAddress    const InetSocketAddress* addrptr =        dynamic_cast<const InetSocketAddress*>(&addr);    if (addrptr == NULL)    {        throw IllegalArgumentException("Invalid SocketAddress");    }    try    {        Synchronized synchronized(_sync);        {        	//_remoteaddr = addrptr->getAddress();            if (_remoteaddr)              delete _remoteaddr;            _remoteaddr = addrptr->getAddress().clone();            _remoteport = addrptr->getPort();            //_impl->connect(_remoteaddr, _remoteport);            _impl->connect(*_remoteaddr, _remoteport,interface);            _status |= TID_SOCKET_STATUS_CONNECTED;        }    }    catch(TIDThr::Exception& e)    {        throw SocketException(e.what());    }}
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:34,


示例5: ExpressionStatement

void Parser::ExpressionStatement() {    _message.print(DBUG, "PARSER: In ExpressionStatement()/n");    //    [ Expression, [ “=”, Expression ] ], “;”    static tokenType firstSet[] = {SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, SYM_SEMICOLON, TOK_IDENT, (tokenType) - 1};    static tokenType followSet[] = {TOK_EOF, KW_ELSE, SYM_CURLY_CLOSE, KW_VOID, KW_INT, KW_FLOAT, SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_CURLY_OPEN, KW_IF, KW_WHILE, KW_RETURN, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    string type, type1;    if ( synchronized(firstSet, followSet, "Expected Expression Statement") ) {        type = Expression();        if( _lookAhead.getTokenType() == SYM_ASSIGN ) {            match(SYM_ASSIGN);            type1 = Expression();            // check that type1 and type2 are assignment compatible            if(!((type == "f" && type1 == "i") ||                    (type == "i" && type1 == "i") ||                    (type == "f" && type1 == "f"))) {                _message.print(ERROR, "SEMANTIC-ANALYZER: Semantic issue on line: %i col: %i. Incompatible assignment", _lookAhead.getRow() , _lookAhead.getCol());            }        }        match(SYM_SEMICOLON);    }    _message.print(DBUG, "PARSER: End of ExpressionStatement()/n");}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:35,


示例6: Statement

void Parser::Statement(string functionName) {    _message.print(DBUG, "PARSER: In Statement()/n");    //    ExpressionStatement    //    | CompoundStatement    //    | SelectionStatement    //    | RepetitionStatement    //    | ReturnStatement    static tokenType statementFirstSet[] = {SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_CURLY_OPEN, KW_IF, KW_WHILE, KW_RETURN, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, SYM_SEMICOLON, (tokenType) - 1};    static tokenType followSet[] = {TOK_EOF, KW_ELSE, SYM_CURLY_CLOSE, KW_VOID, KW_INT, KW_FLOAT, SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_CURLY_OPEN, KW_IF, KW_WHILE, KW_RETURN, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    if ( synchronized(statementFirstSet, followSet, "Expected Statement") ) {        if ( _lookAhead.getTokenType() == SYM_CURLY_OPEN ) {            _symbolTable->openScope();            CompoundStatement(functionName);//            _symbolTable->dump();            _symbolTable->closeScope();        } else if ( _lookAhead.getTokenType() == KW_IF ) {            SelectionStatement(functionName);        } else if ( _lookAhead.getTokenType() == KW_WHILE ) {            RepetitionStatement(functionName);        } else if ( _lookAhead.getTokenType() == KW_RETURN ) {            ReturnStatement(functionName);        } else {            ExpressionStatement();        }    }    _message.print(DBUG, "PARSER: End of Statement()/n");}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:32,


示例7: TypeSpecifier

string Parser::TypeSpecifier() {    _message.print(DBUG, "PARSER: In TypeSpecifier()/n");    //    “void”    //    | “int”    //    | “float”    static tokenType firstSet[] = {KW_FLOAT, KW_INT, KW_VOID, (tokenType) -1};    static tokenType followSet[] = {TOK_IDENT, (tokenType) -1};    string type;    if ( synchronized(firstSet, followSet, "Expected TypeSpecifier") ) {        if ( _lookAhead.getTokenType() == KW_FLOAT ) {            match(KW_FLOAT);            type = "f";        } else if ( _lookAhead.getTokenType() == KW_INT ) {            match(KW_INT);            type = "i";        } else if ( _lookAhead.getTokenType() == KW_VOID ) {            match(KW_VOID);            type = "v";        }    }    _message.print(DBUG, "PARSER: End of TypeSpecifier()/n");    return type;}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:30,


示例8: ReturnStatement

void Parser::ReturnStatement(string functionName) {    _message.print(DBUG, "PARSER: In ReturnStatement()/n");    //    “return”, [ Expression ], “;”    static tokenType firstSet[] = {KW_RETURN, (tokenType) - 1};    static tokenType expressionFirstSet[] = {SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    static tokenType followSet[] = {TOK_EOF, KW_ELSE, SYM_CURLY_CLOSE, KW_VOID, KW_INT, KW_FLOAT, SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_CURLY_OPEN, KW_IF, KW_WHILE, KW_RETURN, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    string type = "v"; // return statements defaults to void    if ( synchronized(firstSet, followSet, "Expected Return Statement") ) {        match(KW_RETURN);        if ( memberOf(_lookAhead.getTokenType(),expressionFirstSet) ) {            type = Expression();        }        string def = _symbolTable->lookup(functionName);        if (!def.empty())            def = def.substr(0,1) == "v" ? "void" : (def.substr(0,1) == "i" ? "int" : "float");        if(def.empty() || def.substr(0,1) != type) {            _message.print(ERROR, "SEMANTIC-ANALYZER: Semantic issue on line: %i col: %i. Function '%s' shoule return '%s' value", _lookAhead.getRow() , _lookAhead.getCol(),functionName.c_str(),def.c_str());        }        match(SYM_SEMICOLON);    }    _message.print(DBUG, "PARSER: End of ReturnStatement()/n");}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:34,


示例9: CompoundStatement

void Parser::CompoundStatement(string functionName) {    _message.print(DBUG, "PARSER: In CompoundStatement()/n");    //“{”, { Declaration | Statement }, “}”    static tokenType compoundStatementFirstSet[] = {SYM_CURLY_OPEN, (tokenType)-1};    static tokenType declarationFirstSet[] = {KW_VOID, KW_INT, KW_FLOAT, (tokenType) - 1};    static tokenType statementFirstSet[] = {SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_CURLY_OPEN, KW_IF, KW_WHILE, KW_RETURN, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    static tokenType followSet[] = {TOK_EOF, KW_ELSE, SYM_CURLY_CLOSE, KW_VOID, KW_INT, KW_FLOAT, SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_CURLY_OPEN, KW_IF, KW_WHILE, KW_RETURN, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    if ( synchronized(compoundStatementFirstSet, followSet, "Expected Compound Statement") ) {        match(SYM_CURLY_OPEN);        while ( memberOf(_lookAhead.getTokenType(), declarationFirstSet) ||                memberOf(_lookAhead.getTokenType(), statementFirstSet) ) {            if ( memberOf(_lookAhead.getTokenType(), declarationFirstSet) ) {                Declaration();            } else if ( memberOf(_lookAhead.getTokenType(), statementFirstSet) ) {                Statement(functionName);            }        }        match(SYM_CURLY_CLOSE);    }    _message.print(DBUG, "PARSER: End of CompoundStatement()/n");}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:32,


示例10: AndExpression

string Parser::AndExpression() {    _message.print(DBUG, "PARSER: In AndExpression()/n");    //    RelationExpression,    //    { “&&”, RelationExpression }    static tokenType firstSet[] = {SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    static tokenType followSet[] = {SYM_OR, SYM_ASSIGN, SYM_SEMICOLON, SYM_OPEN, SYM_SQ_OPEN, SYM_COMMA, SYM_CLOSE, (tokenType) - 1};    string type, type1;    if ( synchronized(firstSet, followSet, "Expected AND Expression") ) {        type = RelationExpression();        while ( _lookAhead.getTokenType() == SYM_AND ) {            type = "i";            match(SYM_AND);            type1 = RelationExpression();            if (!(type == "i" && type1 == "i"))                _message.print(ERROR, "SEMANTIC-ANALYZER: Semantic issue on line: %i col: %i. Conditional statement must return either 0 or 1", _lookAhead.getRow() , _lookAhead.getCol());        }    }    _message.print(DBUG, "PARSER: End of AndExpression()/n");    return type;}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:27,


示例11: LOG

void CAsyncHttp::cancelRequest(const char* szCallback){    if (!szCallback || !*szCallback )    {        LOG(INFO) + "Cancel callback should not be empty. Use * for cancel all";        return;    }    synchronized(getCommandLock());    CHttpCommand* pCmd = (CHttpCommand*)getCurCommand();    if ( pCmd != null && ( *szCallback == '*' || pCmd->m_strCallback.compare(szCallback) == 0) )        pCmd->cancel();    if ( *szCallback == '*' )        getCommands().clear();    else    {        for (int i = getCommands().size()-1; i >= 0; i--)        {            CHttpCommand* pCmd1 = (CHttpCommand*)getCommands().get(i);            if ( pCmd1 != null && pCmd1->m_strCallback.compare(szCallback) == 0 )                getCommands().remove(i);        }    }}
开发者ID:Aerodynamic,项目名称:rhodes,代码行数:28,


示例12: synchronized

voidPacketPool::returnPacket(Packet* p){   JTCSynchronized synchronized(*this);   p->next = firstPacket;   firstPacket = p;}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:7,


示例13: SelectionStatement

void Parser::SelectionStatement(string functionName) {    _message.print(DBUG, "PARSER: In SelectionStatement()/n");    //    “if”, “(”, Expression, “)”, Statement, [ “else”, Statement ]    static tokenType firstSet[] = {KW_IF, (tokenType) - 1};    static tokenType followSet[] = {TOK_EOF, KW_ELSE, SYM_CURLY_CLOSE, KW_VOID, KW_INT, KW_FLOAT, SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_CURLY_OPEN, KW_IF, KW_WHILE, KW_RETURN, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    if ( synchronized(firstSet, followSet, "Expected Selection Statement") ) {        match(KW_IF);        match(SYM_OPEN);        if (Expression() != "i") {            _message.print(ERROR, "SEMANTIC-ANALYZER: Semantic issue on line: %i col: %i. Invalid expression", _lookAhead.getRow() , _lookAhead.getCol());        }        match(SYM_CLOSE);        Statement(functionName);        if (_lookAhead.getTokenType() == KW_ELSE) {            match(KW_ELSE);            Statement(functionName);        }    }    _message.print(DBUG, "PARSER: End of SelectionStatement()/n");}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:31,


示例14: Factor

string Parser::Factor() {    _message.print(DBUG, "PARSER: In Factor()/n");    //[ “+” | “-“ ], Value    static tokenType firstSet[] = {SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    static tokenType followSet[] = {SYM_MUL, SYM_DIV, SYM_MOD, SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_LESS_EQ, SYM_LESS, SYM_GREATER_EQ, SYM_GREATER, SYM_EQUAL, SYM_NOT_EQ, SYM_AND, SYM_OR, SYM_ASSIGN, SYM_SEMICOLON, SYM_OPEN, SYM_SQ_OPEN, SYM_COMMA, SYM_CLOSE, (tokenType) - 1};    string type;    if ( synchronized(firstSet, followSet, "Expected Factor") ) {        bool isNumeric = false;        if ( _lookAhead.getTokenType() == SYM_PLUS ) {            match(SYM_PLUS);            isNumeric = true;        } else if ( _lookAhead.getTokenType() == SYM_MINUS ) {            match(SYM_MINUS);            isNumeric = true;        }        type = Value();        if (isNumeric &&                (type != "i" || type != "f")) {            _message.print(ERROR, "SEMANTIC-ANALYZER: Semantic issue on line: %i col: %i. Invalid operation", _lookAhead.getRow() , _lookAhead.getCol());        }    }    _message.print(DBUG, "PARSER: End of Factor()/n");    return type;}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:35,


示例15: synchronized

void Client::moveSurfaceTo(wl_surface* surface, int32_t x, int32_t y) const{	synchronized(		[this, &surface, &x, &y]() {			wfits_manip_move_surface(wfits_manip_, surface, x, y);		}	);}
开发者ID:01org,项目名称:wayland-fits,代码行数:8,


示例16: synchronized

void LogLoader::checkFirstRun(){    if(firstRun)    {        firstRun = false;        emit synchronized();    }}
开发者ID:thomas3672,项目名称:Arena-Tracker,代码行数:8,


示例17: setState

void CoreConnection::checkSyncState(){    if (_netsToSync.isEmpty() && state() >= Synchronizing) {        setState(Synchronized);        setProgressText(tr("Synchronized to %1").arg(currentAccount().accountName()));        setProgressMaximum(-1);        emit synchronized();    }}
开发者ID:APTX,项目名称:quassel,代码行数:9,


示例18: synchronized

void CLog::Log(const char * msg, ...){	CSynchronized synchronized(&_LogSec);	static char buffer[LOG_BUFFER_SIZE] = { 0, };	va_list args;	va_start(args, msg);	vsnprintf_s(buffer, LOG_BUFFER_SIZE, LOG_BUFFER_SIZE - 1, msg, args);	va_end(args);	std::cout << CurrentDateTime() << " [INFO] " << buffer << std::endl;}
开发者ID:Ho-Gyu-Lee,项目名称:Simple-Game-Server,代码行数:12,


示例19: RelationExpression

string Parser::RelationExpression() {    _message.print(DBUG, "PARSER: In RelationExpression()/n");    //    SimpleExpression,    //    [ ( “<=” | “<” | “>=” | “>” | “==” | “!=” ),    //     SimpleExpression ]    static tokenType firstSet[] = {SYM_PLUS, SYM_MINUS, SYM_NOT, SYM_OPEN, LIT_INT, LIT_FLOAT, LIT_STR, TOK_IDENT, (tokenType) - 1};    static tokenType followSet[] = {SYM_AND, SYM_OR, SYM_ASSIGN, SYM_SEMICOLON, SYM_OPEN, SYM_SQ_OPEN, SYM_COMMA, SYM_CLOSE, (tokenType) - 1};    static tokenType set[] = {SYM_LESS_EQ, SYM_LESS, SYM_GREATER_EQ, SYM_GREATER, SYM_EQUAL, SYM_NOT_EQ, (tokenType) -1};    string type, type1;    if ( synchronized(firstSet, followSet, "Expected Relational Expression") ) {        type = SimpleExpression();        if ( memberOf(_lookAhead.getTokenType(), set) ) {            //check to make sure both types of simpleexpression are numeric            type = "i";            if ( _lookAhead.getTokenType() == SYM_LESS_EQ ) {                match(SYM_LESS_EQ);            } else if( _lookAhead.getTokenType() == SYM_LESS) {                match(SYM_LESS);            } else if( _lookAhead.getTokenType() == SYM_GREATER_EQ ) {                match(SYM_GREATER_EQ);            } else if( _lookAhead.getTokenType() == SYM_GREATER ) {                match(SYM_GREATER);            } else if( _lookAhead.getTokenType() == SYM_EQUAL ) {                match(SYM_EQUAL);            } else if( _lookAhead.getTokenType() == SYM_NOT_EQ ) {                match(SYM_NOT_EQ);            }            type1 = SimpleExpression();            if(!((type == "f" && type1 == "i") ||                    (type == "i" && type1 == "i") ||                    (type == "f" && type1 == "f") ||                    (type == "i" && type1 == "f"))) {                _message.print(ERROR, "SEMANTIC-ANALYZER: Semantic issue on line: %i col: %i. Incompatible comparision", _lookAhead.getRow() , _lookAhead.getCol());            }        }    }    _message.print(DBUG, "PARSER: End of RelationExpression()/n");    return type;}
开发者ID:roshangautam,项目名称:cmm-compiler,代码行数:52,


示例20: synchronized

unsigned long CRhoTimer::getNextTimeout(){    synchronized(m_mxAccess);    if ( (m_arItems.size() == 0) && (m_arNativeItems.size() == 0) )        return 0;    CTimeInterval curTime = CTimeInterval::getCurrentTime();    unsigned long nMinInterval = ((unsigned long)-1);    for( int i = 0; i < (int)m_arItems.size(); i++ )    {        unsigned long nInterval = 0;        if ( m_arItems.elementAt(i).m_oFireTime.toULong() > curTime.toULong() )    		{            nInterval = m_arItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong();    		}    		else    		{	        		nInterval=nMinInterval+m_arItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong();    		}        if ( nInterval < nMinInterval )            nMinInterval = nInterval;    }    for( int i = 0; i < (int)m_arNativeItems.size(); i++ )    {        unsigned long nInterval = 0;        if ( m_arNativeItems.elementAt(i).m_oFireTime.toULong() > curTime.toULong() )    		{            nInterval = m_arNativeItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong();    		}    		else    		{	        		nInterval=nMinInterval+m_arNativeItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong();    		}        if ( nInterval < nMinInterval )            nMinInterval = nInterval;    }    if ( nMinInterval < 100 )        nMinInterval = 100;    RAWTRACE1("CRhoTimer::getNextTimeout: %d",nMinInterval);    return nMinInterval;}
开发者ID:Gaurav2728,项目名称:rhodes,代码行数:50,



注:本文中的synchronized函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ syncpt_op函数代码示例
C++ synchronize_user_stack函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。