Skip to content

libstdc++ c++11 threads support #2

@martell

Description

@martell

Hey @jschmidlapp,
I'm looking to add c++11 threads to a new platform and pthreads-emb look like a nice base.
I have an issue however with libstdc++
pthread_t needs to be a scalar value and not a struct other wise you will get this error

libstdc++-v3/include/thread:88:30: error: no match for ‘operator<’ (operand types are ‘std::thread::native_handle_type {aka pte_handle_t}’ and ‘std::thread::native_handle_type {aka pte_handle_t}’) { return __x._M_thread < __y._M_thread; }

This is the patch I have created to satisfy the change but I am worried about propagating that throughout the library. The reuse thread stack would have to be removed to complete this.

diff --git a/pthread.h b/pthread.h
index 1d86403..eec5148 100644
--- a/pthread.h
+++ b/pthread.h
@@ -391,12 +391,15 @@ enum
      * that available with a simple pointer. It should scale for either
      * IA-32 or IA-64.
      */
+/*
     typedef struct
       {
-        void * p;                   /* Pointer to actual object */
-        unsigned int x;             /* Extra information - reuse count etc */
+        void * p;                   
+        unsigned int x;             
       } pte_handle_t;
+*/

+    typedef uintptr_t pte_handle_t;
     typedef pte_handle_t pthread_t;
     typedef struct pthread_attr_t_ * pthread_attr_t;
     typedef struct pthread_once_t_ pthread_once_t;

What are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions