Thread: Safe Thread Queue

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    3

    Safe Thread Queue

    Hello, I am new at this forum and want to thank you for this opportunity.

    I need to code a thread safe queue in C++ , BUT asked me not to use existing class libraries for this task.
    It has something like wait and notify that can I use ?

    Anyone can help me ? it is possible ?

    thanks

    Mauricio Schoenfelder
    Last edited by mauricio.sch; 01-29-2008 at 04:09 PM. Reason: Add information

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Welcome to the boards.

    Yes, it's possible. Why can't you use existing class libraries? What OS and compiler?

    gg

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    3
    It was a friend of mine, she is a professor. I don't know why can't use libraries, sorry.

    I know a little bit of C++, but don't know how to do it without libraries.

    I thank you any help

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Are you sure you're up for such a challenge then?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    3
    Sorry, it is for Windows and gcc
    Last edited by mauricio.sch; 01-29-2008 at 05:52 PM.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Start by implementing a Queue abstract data type. Once you post the code for that, then we'll look at how to make it thread safe.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Messaging Between Threads, Exiting Thread On Demand, Etc.
    By HyperShadow in forum C++ Programming
    Replies: 10
    Last Post: 06-09-2007, 01:04 PM
  2. ADT queue
    By ^xor in forum C Programming
    Replies: 4
    Last Post: 06-15-2005, 05:43 AM
  3. [code] Win32 Thread Object
    By Codeplug in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2005, 03:55 PM
  4. multithreading question
    By ichijoji in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2005, 10:59 PM
  5. help with queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-21-2002, 09:09 PM