1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Semaphore implementation

Discussion in 'C' started by sonu2die4, Feb 5, 2007.

  1. sonu2die4

    sonu2die4 New Member

    Joined:
    Feb 5, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello,
    I want to know how to implement semaphore without the use of while or any if statement
    The Problem is
    Thread A , B , C they all want to output the result at the same time
    A wants ot print 'A'
    B wants to print 'B'
    C wants to print 'C'
    the output must be 'ABC'. I do not know how to do this.Please help me with the same
    Regards
    Sonu
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Start the B thread from A and C from B and the job is done.
     
  3. sonu2die4

    sonu2die4 New Member

    Joined:
    Feb 5, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    but how would i implement a semaphore for that
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    But why do you need semaphore?
     

Share This Page