Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86369 - trunk/boost/sync/detail
From: andrey.semashev_at_[hidden]
Date: 2013-10-20 11:52:44


Author: andysem
Date: 2013-10-20 11:52:44 EDT (Sun, 20 Oct 2013)
New Revision: 86369
URL: http://svn.boost.org/trac/boost/changeset/86369

Log:
A sketch for TSS API.

Added:
   trunk/boost/sync/detail/link_config.hpp (contents, props changed)
   trunk/boost/sync/detail/tss.hpp (contents, props changed)

Added: trunk/boost/sync/detail/link_config.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/sync/detail/link_config.hpp 2013-10-20 11:52:44 EDT (Sun, 20 Oct 2013) (r86369)
@@ -0,0 +1,54 @@
+/*
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * (C) Copyright 2013 Andrey Semashev
+ */
+/*!
+ * \file link_config.hpp
+ *
+ * \brief This header is the Boost.Sync library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/sync/doc/html/index.html. This header
+ * defines macros for linking with the library.
+ */
+
+#ifndef BOOST_SYNC_DETAIL_LINK_CONFIG_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_LINK_CONFIG_HPP_INCLUDED_
+
+#include <boost/sync/detail/config.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+#if !defined(BOOST_SYNC_DYN_LINK) && defined(BOOST_ALL_DYN_LINK)
+#define BOOST_SYNC_DYN_LINK
+#endif
+
+#if !defined(BOOST_SYNC_NO_LIB) && defined(BOOST_ALL_NO_LIB)
+#define BOOST_SYNC_NO_LIB
+#endif
+
+#if !defined(BOOST_SYNC_BUILDING)
+# if defined(BOOST_SYNC_DYN_LINK)
+# define BOOST_SYNC_API BOOST_SYMBOL_IMPORT
+# endif // defined(BOOST_SYNC_DYN_LINK)
+# if !defined(BOOST_SYNC_NO_LIB)
+# define BOOST_LIB_NAME boost_sync
+# if defined(BOOST_SYNC_DYN_LINK)
+# define BOOST_DYN_LINK
+# endif
+# include <boost/config/auto_link.hpp>
+# endif // !defined(BOOST_SYNC_NO_LIB)
+#else // !defined(BOOST_SYNC_BUILDING)
+# if defined(BOOST_SYNC_DYN_LINK)
+# define BOOST_SYNC_API BOOST_SYMBOL_EXPORT
+# endif
+#endif // !defined(BOOST_SYNC_BUILDING)
+
+#ifndef BOOST_SYNC_API
+#define BOOST_SYNC_API
+#endif
+
+#endif // BOOST_SYNC_DETAIL_LINK_CONFIG_HPP_INCLUDED_

Added: trunk/boost/sync/detail/tss.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/sync/detail/tss.hpp 2013-10-20 11:52:44 EDT (Sun, 20 Oct 2013) (r86369)
@@ -0,0 +1,85 @@
+/*
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * (C) Copyright 2013 Andrey Semashev
+ */
+/*!
+ * \file tss.hpp
+ *
+ * \brief This header is the Boost.Sync library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/sync/doc/html/index.html. In this file
+ * internal thread-specific storage API is defined.
+ */
+
+#ifndef BOOST_SYNC_DETAIL_TSS_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_TSS_HPP_INCLUDED_
+
+#include <boost/sync/detail/link_config.hpp>
+#include <boost/sync/detail/header.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+namespace boost {
+
+namespace sync {
+
+namespace detail {
+
+typedef unsigned int thread_specific_key;
+typedef void (*at_thread_exit_callback)(void*) BOOST_NOEXCEPT;
+
+/*!
+ * \brief Adds a callback to be invoked when the current thread terminates
+ *
+ * The specified callback will be invoked with the context pointer only once. The callback is
+ * responsible for freeing any resources associated with the context upon being called.
+ *
+ * \param callback Pointer to the function to be invoked.
+ * \param context Pointer to the context. This pointer will be passed to the \a callback.
+ */
+BOOST_SYNC_API void add_thread_exit_callback(at_thread_exit_callback callback, void* context);
+
+/*!
+ * \brief Creates a thread-specific key
+ *
+ * \param callback The callback to be called when a thread that used the key terminates. The callback will also be called when the key is deleted.
+ *
+ * \returns The created key.
+ */
+BOOST_SYNC_API thread_specific_key new_thread_specific_key(at_thread_exit_callback callback);
+/*!
+ * \brief Destroys the thread-specific key and all associated values.
+ *
+ * \param key The key to delete. The key cannot be used after executing this function.
+ */
+BOOST_SYNC_API void delete_thread_specific_key(thread_specific_key key) BOOST_NOEXCEPT;
+
+/*!
+ * \brief Acquires the value for the key associated with the calling thread.
+ *
+ * \param key The key that represents the value
+ *
+ * \returns The thread-specific value. Upon the first call, when the thread has not yet set the value, the function returns \c NULL.
+ */
+BOOST_SYNC_API void* get_thread_specific(thread_specific_key key);
+/*!
+ * \brief Installs a value for the key and the current thread.
+ *
+ * \param key The key that represents the value
+ * \param p The value to set
+ */
+BOOST_SYNC_API void set_thread_specific(thread_specific_key key, void* p);
+
+} // namespace detail
+
+} // namespace sync
+
+} // namespace boost
+
+#include <boost/sync/detail/footer.hpp>
+
+#endif // BOOST_SYNC_DETAIL_TSS_HPP_INCLUDED_


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk