threading

Discussion in 'C Programming' started by Aloo, Oct 10, 2005.

  1. Aloo

    Aloo Guest

    hi everybody,

    I was recently trying theading in c on linux using the standard
    threading library. It was a small program for printing a sequence of
    numbers.

    I encountered 2 problems

    1) Each process completed its entire operation the moment it was
    called. The output I got was 01234567891023456789 whereas I was
    expecting 00112233445566778899. Is it due to that the process was so
    small that it finished in the time slice alotted it OR is there any
    other reason. Can I get the output I expected from it without insertion
    of delays.

    2) I was earlier using printf but ws getting the output at the end of
    process completion even with delay in place. Later I got to know that
    'printf' does not have re-entrant code. I want to know why is it
    required? and how does it make the program work differently ?
    Aloo, Oct 10, 2005
    #1
    1. Advertising

  2. In article <>,
    Aloo <> wrote:
    >I was recently trying theading in c on linux using the standard
    >threading library. It was a small program for printing a sequence of
    >numbers.


    >I encountered 2 problems


    comp.lang.c devotes itself to standard C. Questions about threads
    are best addressed to a newsgroup that deals with threads (which
    are not part of standard C).


    >1) Each process completed its entire operation the moment it was
    >called. The output I got was 01234567891023456789 whereas I was
    >expecting 00112233445566778899. Is it due to that the process was so
    >small that it finished in the time slice alotted it OR is there any
    >other reason. Can I get the output I expected from it without insertion
    >of delays.


    >2) I was earlier using printf but ws getting the output at the end of
    >process completion even with delay in place. Later I got to know that
    >'printf' does not have re-entrant code. I want to know why is it
    >required? and how does it make the program work differently ?


    When you post to the appropriate thread-related newsgroup, you
    should include code samples showing how the values were produced.
    The behaviour you describe could have a number of different causes.
    I could list my top 83 speculations, but it would be much less work
    all around if you were to post code in an appropriate newsgroup.
    --
    Programming is what happens while you're busy making other plans.
    Walter Roberson, Oct 10, 2005
    #2
    1. Advertising

  3. "Aloo" <> writes:
    > I was recently trying theading in c on linux using the standard
    > threading library. It was a small program for printing a sequence of
    > numbers.


    Try comp.programming.threads.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Oct 10, 2005
    #3
    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. Lenny Pervin

    Threading in a web-based app

    Lenny Pervin, Jul 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    991
    Oisin Grehan
    Jul 8, 2003
  2. Alina
    Replies:
    0
    Views:
    1,668
    Alina
    Jul 16, 2003
  3. Replies:
    9
    Views:
    1,008
    Mark Space
    Dec 29, 2007
  4. Steven Woody
    Replies:
    0
    Views:
    393
    Steven Woody
    Jan 9, 2009
  5. Steven Woody
    Replies:
    0
    Views:
    432
    Steven Woody
    Jan 9, 2009
Loading...

Share This Page