Unverified Commit 9abbf010 authored by yiwu-arbug's avatar yiwu-arbug Committed by GitHub

implemented !Send for PerfContext struct (#442)

fix tikv/tikv#6973

As mentioned in the linked issue, the aim is to implement `!Send` for the `PerfContext` struct.
Although the issue is related to the `tikv/tikv` repo, the concerned `PerfContext` is taken from this repo. 
Due to the rule that "foreign traits can't be implemented on foreign types", it isn't possible to directly implement the `!Send` trait on the `PerfContext` struct. So, either I had to enclose the `PerfContext` within another type and implement `!Send` for the new type (along with implementing all the functions present for `PerfContext`), or directly add the `!Send` implementation, where the struct is defined, i.e, in this repo.  I've taken the second path.
but, there is a problem. `impl !Send` is currently only supported in nightly and not on stable channel.
So, it's necessary to build this crate with nightly toolchain, if this patch is accepted.
Signed-off-by: 's avatarGovardhan G D <govardhangdg@gmail.com>
parent 51f5d851
......@@ -13,6 +13,7 @@
// limitations under the License.
//
#![feature(optin_builtin_traits)]
extern crate core;
extern crate libc;
#[macro_use]
......
......@@ -57,6 +57,8 @@ pub struct PerfContext {
inner: *mut DBPerfContext,
}
impl !Send for PerfContext {}
impl PerfContext {
pub fn get() -> PerfContext {
unsafe {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment