You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2019/04/28 14:09:20 UTC

[GitHub] [incubator-brpc] jasonszang opened a new pull request #749: Modernizing bthread: modern style C++ bthread support library, the essential subset

jasonszang opened a new pull request #749: Modernizing bthread: modern style C++ bthread support library, the essential subset
URL: https://github.com/apache/incubator-brpc/pull/749
 
 
   This PR provides a subset of concurrency supporting features provided by Thread Support Library
   in C++11. The final goal of this PR and planned following ones is to provide a full fledged modern
   C++ threading library for bthread, enabling much easier concurrent programming with brpc and
   modern C++.
   
   The APIs and semantics of provided classes and functions are identical to their `std`
   counterparts. Starting bthreads with lambdas and functors are not supported. Some existing
   "cpp wrappers" e.g. `Mutex` and `ConditionVariable` are also updated to provide consistent API with
   the C++ standard.
   
   The rationale behind this is that by closely mirroring the C++ standard a good modern C++
   programmer experienced in `std` threading libraries will be able to use the C++ bthread APIs well
   without even needing to learn.
   
   Currently provided features:
   
   | Feature | `std` counterpart | Header | Note |
   | --- | --- | --- | --- |
   | bthread::BThread | std::thread | bthreadxx.h | |
   | bthread::this_bthread | std::this_thread | bthreadxx.h | yield, get_id, sleep_for, sleep_until |
   | bthread::Mutex | std::mutex | mutex.h | Updated to match the standard |
   | bthread::TimedMutex | std::timed_mutex | mutex.h | |
   | bthread::RecursiveMutex | std::recursive_mutex | mutex.h | |
   | bthread::RecursiveTimedMutex | std::recursive_timed_mutex | mutex.h | |
   | bthread::ConditionVariable | std::condition_variable | condition_variable.h | |
   | bthread::ConditionVariableAny | std::condition_variable_any | condition_variable.h | |
   
   To use these features simply include the corresponding headers. For the generic constructs like
   `std::unique_lock`, just use the `std` ones and they work well with things like `bthread::Mutex`.
   
   Other missing featurs like `future`s and `promise`s are planned and I'm working on it.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org