POSIX threads problem

Discussion in 'C Programming' started by kalooo, Nov 3, 2010.

  1. kalooo

    kalooo

    Joined:
    Oct 17, 2010
    Messages:
    2
    hello,
    i create two threads(POSIX) but always my program join in the first thread and ignore the other. I can't understand it. Here is my code:

    void *play1(void *arg){..}
    void *play2(void *arg){..}

    int main(){

    pthread_t player1,player2;

    pthread_create(&player1,NULL,play1,(void *)0);
    pthread_create(&player2,NULL,play2,(void *)1);
    pthread_setconcurrency(2);
    pthread_join(player1, NULL);
    pthread_join(player2, NULL);

    return 0;
    }
    kalooo, Nov 3, 2010
    #1
    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. Evan David Light
    Replies:
    6
    Views:
    454
    David Anderson
    Dec 1, 2003
  2. Heiko Neuhaus

    POSIX Threads causing memory leak

    Heiko Neuhaus, Dec 21, 2003, in forum: C++
    Replies:
    3
    Views:
    2,566
    Paul Pluzhnikov
    Dec 21, 2003
  3. Chaman Singh

    STL map and Posix Threads

    Chaman Singh, Apr 8, 2004, in forum: C++
    Replies:
    3
    Views:
    530
    Nick Hounsome
    Apr 9, 2004
  4. Christian Buckl
    Replies:
    6
    Views:
    675
    Alf P. Steinbach
    Oct 8, 2004
  5. JackC
    Replies:
    14
    Views:
    627
    James Kanze
    Oct 16, 2007
Loading...

Share This Page