// bsl_thread.h                                                       -*-C++-*-
#ifndef INCLUDED_BSL_THREAD
#define INCLUDED_BSL_THREAD

#include <bsls_ident.h>
BSLS_IDENT("$Id: $")

//@PURPOSE: Provide functionality of the corresponding C++ Standard header.
//
//@DESCRIPTION: Provide types, in the `bsl` namespace, equivalent to those
// defined in the corresponding C++ standard header.  Include the native
// compiler-provided standard header, and also directly include Bloomberg's
// implementation of the C++ standard type (if one exists).  Finally, place the
// included symbols from the `std` namespace (if any) into the `bsl` namespace.

#include <bsls_libraryfeatures.h>

#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
#include <bsls_nativestd.h>
#endif // BDE_DONT_ALLOW_TRANSITIVE_INCLUDES

// `<thread>` provides `std::hash<std::thread::id>`, so we must provide
// `bsl::hash<std::thread::id>` (even if `<bsl_functional.h>` has not been
// included).  And we might as well include `<bslstl_hash.h>` in all language
// versions to avoid surprises when upgrading.
#include <bslstl_hash.h>

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
#include <thread>
namespace bsl {

    //using std::this_thread;
    namespace this_thread{
        using std::this_thread::get_id;
        using std::this_thread::yield;
        using std::this_thread::sleep_until;
        using std::this_thread::sleep_for;
    }  // close namespace this_thread
    using std::thread;

    template <>
    struct hash<std::thread::id> : std::hash<std::thread::id> { };

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_JTHREAD
    using std::jthread;
#endif
}  // close package namespace
#endif  // C++11

#endif

// ----------------------------------------------------------------------------
// Copyright 2015 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------
