Giter Club home page Giter Club logo

Comments (3)

cameron314 avatar cameron314 commented on June 18, 2024

Sorry for the delay, I accidentally broke all incoming traffic (including emails, like those from GitHub) to my server :-{

There's two reasons. First, std::this_thread::get_id() is very slow on certain key platforms, like Windows (orders of magnitude slower than calling GetCurrentThreadId()). Second, the type of the object returned is implementation defined. I need a thread ID that I can use inside a special-purpose lock-free hash internally, and for that I need some sort of numeric/pointer type with a defined maximum size.

Also, ideally I need two invalid thread ID values; std::thread_id has just one. This is currently only used in code that is disabled (because it causes problems for some people), but eventually I'd like to enable that code, and for that I need a second invalid thread ID.

I only use std::thread_id on iOS because there's no better way to get a thread ID, and even then it's reinterpreted as a numeric type (this relies on platform-specific implementation details, but is better than not having support for iOS at all, and these details are at least unlikely to change).

from concurrentqueue.

Cthutu avatar Cthutu commented on June 18, 2024

Thanks for the reply. I was just curious.

On Wed, 30 Mar 2016 at 16:28 Cameron [email protected] wrote:

Sorry for the delay, I accidentally broke all incoming traffic (including
emails, like those from GitHub) to my server :-{

There's two reasons. First, std::thread::this_thread::get_id() is very
slow on certain key platforms, like Windows (orders of magnitude slower
than calling GetCurrentThreadId()). Second, the type of the object
returned is implementation defined. I need a thread ID that I can use
inside a special-purpose lock-free hash internally, and for that I need
some sort of numeric/pointer type with a defined maximum size.

I only use std::thread_id on iOS because there's no better way to get a
thread ID, and even then it's reinterpreted as a numeric type (this relies
on platform-specific implementation details, but is better than not having
support for iOS at all, and these details are at least unlikely to change).


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#43 (comment)

from concurrentqueue.

cameron314 avatar cameron314 commented on June 18, 2024

No problem :-)

from concurrentqueue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.