Thread: Thread-safe singleton.

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    97

    Thread-safe singleton.

    Hello, I'm currently trying to do some time multi-threaded cross-platform application with multiple cores. I need to use some high performance singletons but I haven't been able to find a good thread-safe singleton. Many people suggest using a double-checked locking singleton but I have found a paper http://www.aristeia.com/Papers/DDJ_J...04_revised.pdf which shows why that solution isn't reliable. Is there any high performance thread-safe singleton I can use or am I better just storing the pointer returned by singleton in each thread?

    Thanks.

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I remember this article mentioning something thready, but it might not be of any use, just thought I'd throw it at you while I've got a second

    http://gethelp.devx.com/techtips/cpp.../10min0200.asp
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    97
    That solution isn't thread-safe, thanks anyway.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    consider loki

    more better libraries remain private

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. thread safe in my code to manipulate List?
    By George2 in forum C# Programming
    Replies: 8
    Last Post: 05-01-2008, 06:57 AM
  2. are winsock functions thread safe?
    By *DEAD* in forum Networking/Device Communication
    Replies: 2
    Last Post: 12-15-2007, 10:37 AM
  3. Replies: 2
    Last Post: 07-01-2007, 07:11 AM
  4. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  5. C++ Threading?
    By draggy in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2005, 12:16 PM