[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/LIBCXX PATCH v2] Enable threads support



Hi Costin,

This patch looks good, thanks.

-- Felipe

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On 04.06.19, 22:54, "Costin Lupu" <costin.lupu@xxxxxxxxx> wrote:

    This patch defines the macros and adds the hashtable template required for
    enabling threads support in cxx library.
    
    Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
    Signed-off-by: Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
    Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
    ---
     Config.uk                                     |  6 +++
     Makefile.uk                                   |  5 ++
     ...-Add-hashtable-template-for-pthreads.patch | 51 +++++++++++++++++++
     3 files changed, 62 insertions(+)
     create mode 100644 patches/0003-Add-hashtable-template-for-pthreads.patch
    
    diff --git a/Config.uk b/Config.uk
    index 9962669..16a11dc 100644
    --- a/Config.uk
    +++ b/Config.uk
    @@ -4,3 +4,9 @@ menuconfig LIBCXX
        select LIBCXXABI
        select LIBUNWIND
         default n
    +
    +if LIBCXX
    +config CXX_THREADS
    +    bool "Enable CXX threads support"
    +    default n
    +endif
    diff --git a/Makefile.uk b/Makefile.uk
    index a455386..b673f72 100644
    --- a/Makefile.uk
    +++ b/Makefile.uk
    @@ -96,6 +96,11 @@ CONFIG_FLAGS     += -D LIBCXX_BUILDING_LIBCXXABI         
\
                -D _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE -D __DYNAMIC_REENT__     
\
     
     
    +ifdef CONFIG_CXX_THREADS
    +CONFIG_FLAGS += -D__linux__ -D_LIBCPP_HAS_THREAD_API_PTHREAD
    +else
    +CONFIG_FLAGS += -D_LIBCPP_HAS_NO_THREADS
    +endif
     
     LIBCXX_CFLAGS-y    +=   $(CONFIG_FLAGS)
     LIBCXX_CXXFLAGS-y    +=   $(CONFIG_FLAGS)
    diff --git a/patches/0003-Add-hashtable-template-for-pthreads.patch 
b/patches/0003-Add-hashtable-template-for-pthreads.patch
    new file mode 100644
    index 0000000..6a99062
    --- /dev/null
    +++ b/patches/0003-Add-hashtable-template-for-pthreads.patch
    @@ -0,0 +1,51 @@
    +From 215ae6f079c9d3e1ed21fc549e41ef5d6d796d71 Mon Sep 17 00:00:00 2001
    +From: Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
    +Date: Thu, 18 Apr 2019 15:15:33 +0300
    +Subject: [PATCH] Add hashtable template for pthreads
    +
    +Signed-off-by: Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
    +---
    + include/utility | 20 +++++++++++++++++++++
    + 1 file changed, 20 insertions(+)
    +
    +diff --git a/include/utility b/include/utility
    +index ed9bf03..c5b74fd 100644
    +--- a/include/utility
    ++++ b/include/utility
    +@@ -205,6 +205,10 @@ template <size_t I>
    + #include <cstdint>
    + #include <__debug>
    +
    ++#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
    ++#include <pthread.h>
    ++#endif
    ++
    + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
    + #pragma GCC system_header
    + #endif
    +@@ -1473,6 +1478,22 @@ struct _LIBCPP_TEMPLATE_VIS hash<double>
    +     }
    + };
    + 
    ++#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
    ++template <>
    ++struct _LIBCPP_TEMPLATE_VIS hash<pthread_t>
    ++    : public __scalar_hash<size_t>
    ++{
    ++    _LIBCPP_INLINE_VISIBILITY
    ++    size_t operator()(pthread_t __v) const _NOEXCEPT
    ++    {
    ++       // -0.0 and 0.0 should return same hash
    ++       if (__v == 0)
    ++           return 0;
    ++        return __scalar_hash<size_t>::operator()((size_t) __v.p);
    ++    }
    ++};
    ++#endif
    ++
    + template <>
    + struct _LIBCPP_TEMPLATE_VIS hash<long double>
    +     : public __scalar_hash<long double>
    +-- 
    +2.11.0
    +
    -- 
    2.20.1
    
    

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.