Why multiple threads are not started ? pls help

Discussion in 'Software' started by mandrake, Apr 21, 2009.

  1. mandrake

    mandrake

    Joined:
    Apr 21, 2009
    Messages:
    1
    hi,

    I have done a small c++ program using qpthread library.
    The problem is i need to start three threads but instead only first two threads are started.
    I am unable to find the reason.
    Here are some of the details of environment,
    compiler : g++ v4.1.1
    OS : centos (kernel v2.6.18 )

    Thanks in advance.



    Code:
    #include <qpthr/qp.h>
    #include <stdlib.h>
    #include <iostream>
    using namespace qpthr;
    using namespace std;
    
    
    class Thread1 : public QpThread
    {
        virtual void Main()
        { 
           cout << " executing thread 1"<< endl;
        }
    };
    class Thread2 : public QpThread
    {
        public:
            virtual void Main()
            {
                 cout << " executing thread 2"<< endl;
            }
    };
    
    
    
    
    
    class Thread3 : public QpThread
    {
    
        virtual void Main()
        {
           cout << " executing thread 3"<< endl;
        }
    };
    
    
    
    
    int main()
    {
        switch (fork())
        {
            case -1:
                break;
            case 0:
                setsid();
                break;
            default:
                exit(0);
        }
    
    
    
        QpInit qp_init;
        Thread1 othr1;
        Thread2 othr2;
        Thread3 othr3;
    
         othr1.Start();
         othr2.Start();
         othr3.Start();
    
    
        return 0;
    }
    
    mandrake, Apr 21, 2009
    #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. Stig Ove Voll

    Ignoring multiple threads

    Stig Ove Voll, Mar 8, 2005, in forum: Firefox
    Replies:
    0
    Views:
    428
    Stig Ove Voll
    Mar 8, 2005
  2. olabanji  timothy

    pls, help.. i need a number..pls

    olabanji timothy, Sep 9, 2003, in forum: MCSE
    Replies:
    7
    Views:
    822
  3. The Invisible Man

    TB View, Threads, Threads with unread

    The Invisible Man, Mar 6, 2006, in forum: Firefox
    Replies:
    1
    Views:
    568
    Splibbilla
    Mar 20, 2006
  4. Walterramjet

    how do I find see only the threads I've started without wading thr

    Walterramjet, Jan 6, 2008, in forum: Microsoft Certification
    Replies:
    3
    Views:
    464
    Robert Williams [CertGuard]
    Jan 8, 2008
  5. irfansmith@gmail.com

    URGENT - Pls help...pls recommend - laptop purchase

    irfansmith@gmail.com, Aug 15, 2008, in forum: Computer Information
    Replies:
    2
    Views:
    658
    trouble
    Aug 16, 2008
Loading...

Share This Page