port.h 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. //
  6. // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
  7. // Use of this source code is governed by a BSD-style license that can be
  8. // found in the LICENSE file. See the AUTHORS file for names of contributors.
  9. #pragma once
  10. #include <string>
  11. // Include the appropriate platform specific file below. If you are
  12. // porting to a new platform, see "port_example.h" for documentation
  13. // of what the new port_<platform>.h file must provide.
  14. #if defined(ROCKSDB_PLATFORM_POSIX)
  15. #include "port/port_posix.h"
  16. #elif defined(OS_WIN)
  17. #include "port/win/port_win.h"
  18. #endif
  19. #ifdef OS_LINUX
  20. // A temporary hook into long-running RocksDB threads to support modifying their
  21. // priority etc. This should become a public API hook once the requirements
  22. // are better understood.
  23. // Returns true if query is aborted.
  24. extern "C" bool RocksDbThreadYieldAndCheckAbort() __attribute__((__weak__));
  25. #define ROCKSDB_THREAD_YIELD_CHECK_ABORT() \
  26. (RocksDbThreadYieldAndCheckAbort ? RocksDbThreadYieldAndCheckAbort() : false)
  27. #else
  28. #define ROCKSDB_THREAD_YIELD_CHECK_ABORT() (false)
  29. #endif