Does c++ standart support thread? Is _beginthreadex the standard function?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • codefuns

    Does c++ standart support thread? Is _beginthreadex the standard function?

    If C++ standard support multithread, how can it implements writers and
    readers problem?
    the requirements is:
    1.there are more than one writers and more than one readers
    2.only one writer can write to a memory block at a time, when it
    writes, no other readers can read this memory block.
    3.all the readers can read the memory block at the same time.
    4.when there is a writer want to write data to the memory block, other
    readers that want to read the memory block after that time should be
    blocked and be waked when there is no writers write data to the memory
    block.

    what Synchronization technic should I use? seems mutex and semaphore
    all don't work for this requirement.

    I am a newbie, thanks for all your helps.

  • Ben Pope

    #2
    Re: Does c++ standart support thread? Is _beginthreadex the standardfunctio n?

    codefuns wrote:[color=blue]
    > If C++ standard support multithread,[/color]

    It doesn't.
    [color=blue]
    > how can it implements writers and
    > readers problem?
    > the requirements is:
    > 1.there are more than one writers and more than one readers
    > 2.only one writer can write to a memory block at a time, when it
    > writes, no other readers can read this memory block.
    > 3.all the readers can read the memory block at the same time.
    > 4.when there is a writer want to write data to the memory block, other
    > readers that want to read the memory block after that time should be
    > blocked and be waked when there is no writers write data to the memory
    > block.
    >
    > what Synchronization technic should I use? seems mutex and semaphore
    > all don't work for this requirement.
    >
    > I am a newbie, thanks for all your helps.[/color]

    Boost (which is non-standard, but widely used) has a threading library
    which uses the platform specific features of your platform (Windows and
    Posix, maybe others) and provides tools for threaded programming, to
    solve these problems.



    Ben Pope
    --
    I'm not just a number. To many, I'm known as a string...

    Comment

    • codefuns

      #3
      Re: Does c++ standart support thread? Is _beginthreadex the standard function?

      thanks for your help. and anyone can tell me which Synchronization
      technic should I use to solve this problem. I think reader and writer
      is a common Synchronization problem, and it should have a common method
      to solve it. I am new to multithread programming, need your more helps.

      Comment

      • Ben Pope

        #4
        Re: Does c++ standart support thread? Is _beginthreadex the standardfunctio n?

        codefuns wrote:[color=blue]
        > thanks for your help. and anyone can tell me which Synchronization
        > technic should I use to solve this problem. I think reader and writer
        > is a common Synchronization problem, and it should have a common method
        > to solve it. I am new to multithread programming, need your more helps.[/color]

        This is off topic here, since C++ does not have any mechanisms for doing
        this. You'd be better off with a book on threads.

        Or in a newsgroup that deals with threads.

        Or a website that deals with threads.

        Ben Pope
        --
        I'm not just a number. To many, I'm known as a string...

        Comment

        • Sandeep

          #5
          Re: Does c++ standart support thread? Is _beginthreadex the standard function? - OT


          codefuns wrote:[color=blue]
          > thanks for your help. and anyone can tell me which Synchronization
          > technic should I use to solve this problem. I think reader and writer
          > is a common Synchronization problem, and it should have a common method
          > to solve it. I am new to multithread programming, need your more helps.[/color]

          Every library that provides multi threading support, provides support
          for synchronization . for example boost provides for synchronization
          primitives such as boost::mutex. Refer to documentation of the library
          that you would ultimately use.



          Comment

          Working...