コード例 #1
0
ファイル: message.cpp プロジェクト: 3rf/mongo
namespace mongo {

    void Message::send( MessagingPort &p, const char *context ) {
        if ( empty() ) {
            return;
        }
        if ( _buf != 0 ) {
            p.send( _buf, MsgData::ConstView(_buf).getLen(), context );
        }
        else {
            p.send( _data, context );
        }
    }

    AtomicWord<MSGID> NextMsgId;

    /*struct MsgStart {
        MsgStart() {
            NextMsgId = (((unsigned) time(0)) << 16) ^ curTimeMillis();
            verify(MsgDataHeaderSize == 16);
        }
    } msgstart;*/

    MSGID nextMessageId() {
        return NextMsgId.fetchAndAdd(1);
    }

    bool doesOpGetAResponse( int op ) {
        return op == dbQuery || op == dbGetMore;
    }


} // namespace mongo
コード例 #2
0
ファイル: message.cpp プロジェクト: 3rf/mongo
 MSGID nextMessageId() {
     return NextMsgId.fetchAndAdd(1);
 }
コード例 #3
0
ファイル: index_access_method.cpp プロジェクト: ajdavis/mongo
/**
 * Generates a new file name on each call using a static, atomic and monotonically increasing
 * number.
 *
 * Each user of the Sorter must implement this function to ensure that all temporary files that the
 * Sorter instances produce are uniquely identified using a unique file name extension with separate
 * atomic variable. This is necessary because the sorter.cpp code is separately included in multiple
 * places, rather than compiled in one place and linked, and so cannot provide a globally unique ID.
 */
std::string nextFileName() {
    static AtomicWord<unsigned> indexAccessMethodFileCounter;
    return "extsort-index." + std::to_string(indexAccessMethodFileCounter.fetchAndAdd(1));
}