a thread safe stack?

Discussion in 'C++' started by Gernot Frisch, Sep 14, 2004.

  1. Hi,
    I need a stack I can access from many threads simultanously. How do I
    archive it? (No STL, please - real code)

    --
    -Gernot
    int main(int argc, char** argv) {printf
    ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

    ________________________________________
    Looking for a good game? Do it yourself!
    GLBasic - you can do
    www.GLBasic.com
    Gernot Frisch, Sep 14, 2004
    #1
    1. Advertising

  2. Martin Eisenberg, Sep 14, 2004
    #2
    1. Advertising

  3. Gernot Frisch

    Julie Guest

    Gernot Frisch wrote:
    >
    > Hi,
    > I need a stack I can access from many threads simultanously. How do I
    > archive it? (No STL, please - real code)


    What, STL is fake code?

    Anyway, you are in the wrong newsgroup -- there isn't a way to do this w/
    standard C++ language constructs in a platform independent way. You need to
    take this question to a forum that discusses your OS and/or framework library.
    Julie, Sep 14, 2004
    #3
  4. "Gernot Frisch" <> skrev i en meddelelse
    news:...
    > Hi,
    > I need a stack I can access from many threads simultanously. How do I
    > archive it? (No STL, please - real code)
    >
    > --
    > -Gernot
    > int main(int argc, char** argv) {printf
    > ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
    >
    > ________________________________________
    > Looking for a good game? Do it yourself!
    > GLBasic - you can do
    > www.GLBasic.com
    >
    >

    Your question is off-topic here. Try either
    comp.for.men.c++.no_fucking_stl - or - comp.programming.threads.

    /Peter
    Peter Koch Larsen, Sep 14, 2004
    #4
  5. > Your question is off-topic here. Try either
    > comp.for.men.c++.no_fucking_stl - or - comp.programming.threads.


    Sorry. I can't use STL in this project. I love STL for other projects.
    If I set a "locked" bit on the buffer, that would be enough, no?
    Gernot Frisch, Sep 14, 2004
    #5
  6. Gernot Frisch

    Xenos Guest

    "Gernot Frisch" <> wrote in message
    news:...
    > Hi,
    > I need a stack I can access from many threads simultanously. How do I
    > archive it? (No STL, please - real code)
    >

    Contrary to popular belief, it is possible in standard C++ to guarantee
    mutal exclusion (such as Dekker's algorithm). Though, such methods are
    never very efficient, and as such its best to use OS-specific calls.

    Note: *everyone* asks this when starting out. No, just setting a
    busy/in-use flag will not guarantee serialize access to the stack!

    DrX
    Xenos, Sep 14, 2004
    #6
  7. Gernot Frisch wrote:

    > Hi,
    > I need a stack I can access from many threads simultanously. How do I
    > archive it? (No STL, please - real code)


    The ACE framework (http://www.cs.wustl.edu/~schmidt/ACE.html) contains non
    STL containers as well as MT support

    Lothar
    Lothar Werzinger, Sep 15, 2004
    #7
  8. Gernot Frisch

    Jack Klein Guest

    On Tue, 14 Sep 2004 22:01:57 +0200, "Gernot Frisch" <>
    wrote in comp.lang.c++:

    > > Your question is off-topic here. Try either
    > > comp.for.men.c++.no_fucking_stl - or - comp.programming.threads.

    >
    > Sorry. I can't use STL in this project. I love STL for other projects.
    > If I set a "locked" bit on the buffer, that would be enough, no?


    What people are trying to tell you is that C++ does not have a
    "locked" bit. The language has no support for multitasking at all.
    All such code relies on platform-specific extensions supplied by the
    operating system, and can differ with different operating systems and
    compilers/libraries.

    So it's off-topic here and needs to be asked in either a group that
    specifically supports threads, such as comp.programming.threads as
    suggested, or a group for your particular compiler/OS combination such
    as news:comp.os.ms-windows.win32.programmer or one of Microsoft's
    support groups in the news:microsoft.public.vc.* family.

    It is not a C++ language question.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, Sep 15, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gabriel Rossetti
    Replies:
    0
    Views:
    1,299
    Gabriel Rossetti
    Aug 29, 2008
  2. Replies:
    0
    Views:
    1,294
  3. Ankur Arora
    Replies:
    1
    Views:
    558
    Michael Doubez
    Jun 26, 2009
  4. Replies:
    1
    Views:
    327
    Brian Candler
    Aug 12, 2003
  5. John Nagle
    Replies:
    5
    Views:
    454
    John Nagle
    Mar 12, 2012
Loading...

Share This Page