semaphore

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

    semaphore

    Hai,
    I'm new to multithread programming. Now has some doubt on it. Hope anybody
    can help.

    How do use the semphore?

    Thanks


  • Victor Bazarov

    #2
    Re: semaphore

    "chiew peng" <limchiewpeng@i wow.com.sg> wrote...[color=blue]
    > I'm new to multithread programming. Now has some doubt on it. Hope[/color]
    anybody[color=blue]
    > can help.
    >
    > How do use the semphore?[/color]

    A semaphore is a global variable with two (rarely more) known
    states. Threads can gain access to semaphores using some king
    of OS mechanism and check the states of the semaphores. But
    since C++ doesn't define semaphores, they are off-topic here.

    The best place to ask is comp.programmin g.threads.

    Victor


    Comment

    • chiew peng

      #3
      Re: semaphore

      Ok, anyway thanks!

      "Victor Bazarov" <v.Abazarov@att Abi.com> wrote in message
      news:9_6Na.6718 $NW6.4716@rwcrn sc51.ops.asp.at t.net...[color=blue]
      > "chiew peng" <limchiewpeng@i wow.com.sg> wrote...[color=green]
      > > I'm new to multithread programming. Now has some doubt on it. Hope[/color]
      > anybody[color=green]
      > > can help.
      > >
      > > How do use the semphore?[/color]
      >
      > A semaphore is a global variable with two (rarely more) known
      > states. Threads can gain access to semaphores using some king
      > of OS mechanism and check the states of the semaphores. But
      > since C++ doesn't define semaphores, they are off-topic here.
      >
      > The best place to ask is comp.programmin g.threads.
      >
      > Victor
      >
      >[/color]


      Comment

      • Alexander Terekhov

        #4
        Re: semaphore


        Victor Bazarov wrote:[color=blue]
        >
        > "chiew peng" <limchiewpeng@i wow.com.sg> wrote...[color=green]
        > > I'm new to multithread programming. Now has some doubt on it. Hope[/color]
        > anybody[color=green]
        > > can help.
        > >
        > > How do use the semphore?[/color]
        >
        > A semaphore is a global variable with two (rarely more) known
        > states. Threads can gain access to semaphores using some king
        > of OS mechanism and check the states of the semaphores. But
        > since C++ doesn't define semaphores, they are off-topic here.[/color]

        They are brain-damaged (as far as THREADING is concerned).
        [color=blue]
        >
        > The best place to ask is comp.programmin g.threads.[/color]

        <Forward Inline>

        -------- Original Message --------
        Newsgroups: comp.programmin g.threads
        Subject: Re: semaphore

        chiew peng wrote:[color=blue]
        >
        > Hi,
        > I'm new to multithread programming. Now has some doubt on it. Hope anybody
        > can help.
        >
        > How do use the semphore?[/color]


        (The Little Book of Semaphores, Copyright (C) 2003 Allen B. Downey)

        Now, check out this thread (please follow the embedded links):


        (Subject: [boost] no semaphores in boost::thread)

        Try to NOT miss the following msgs of mine... I'll copy&paste only one
        of them below:





        Maciej Sobczak wrote:
        [...][color=blue]
        > What about providing both (condvars and semas), but with documenting
        > known pros and cons?[/color]

        Personally, I'd have no problems with some *separate* Boost.Semas (for
        things meant to be done by the current POSIX/IPC semaphores: async-
        signal-safe unlock operation, memory-isolated synchronization ) library
        with the "attached sticker" ala "Intergalac tic Surgeon General's
        Warning: DON'T USE IT FOR THREADING!" (or something like that). Well,
        that would actually fit rather nicely into "The POSIX++ Vision". ;-)

        regards,
        alexander.

        --

        Comment

        Working...