コード例 #1
0
ファイル: message.cpp プロジェクト: 3rf/mongo
 MSGID nextMessageId() {
     return NextMsgId.fetchAndAdd(1);
 }
コード例 #2
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));
}