Revision a62096696928f0280b9195c36b1a6446311b5e7c authored by Jos Collin on 10 May 2017, 01:43:23 UTC, committed by Facebook Github Bot on 10 May 2017, 02:06:39 UTC
Summary: Updated PhysicalCoreID() to use sched_getcpu() on x86_64 for glibc >= 2.22. Added a new function named GetCPUID() that calls sched_getcpu(), to avoid repeated code. This change is done as per the comments of PR: https://github.com/facebook/rocksdb/pull/2230 Signed-off-by: Jos Collin <jcollin@redhat.com> Closes https://github.com/facebook/rocksdb/pull/2260 Differential Revision: D5025734 Pulled By: ajkr fbshipit-source-id: f4cca68c12573cafcf8531e7411a1e733bbf8eef
1 parent df035b6
flush_scheduler.h
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
// This source code is also licensed under the GPLv2 license found in the
// COPYING file in the root directory of this source tree.
#pragma once
#include <stdint.h>
#include <atomic>
#include <mutex>
#include <set>
namespace rocksdb {
class ColumnFamilyData;
// Unless otherwise noted, all methods on FlushScheduler should be called
// only with the DB mutex held or from a single-threaded recovery context.
class FlushScheduler {
public:
FlushScheduler() : head_(nullptr) {}
// May be called from multiple threads at once, but not concurrent with
// any other method calls on this instance
void ScheduleFlush(ColumnFamilyData* cfd);
// Removes and returns Ref()-ed column family. Client needs to Unref().
// Filters column families that have been dropped.
ColumnFamilyData* TakeNextColumnFamily();
bool Empty();
void Clear();
private:
struct Node {
ColumnFamilyData* column_family;
Node* next;
};
std::atomic<Node*> head_;
#ifndef NDEBUG
std::mutex checking_mutex_;
std::set<ColumnFamilyData*> checking_set_;
#endif // NDEBUG
};
} // namespace rocksdb
Computing file changes ...