root/juggler/tags/1.0.5/Threads/vjBaseThread.cpp

Revision 3829, 2.5 kB (checked in by patrickh, 8 years ago)

Added an extra space to the string used when there is no applicable thread
ID. This is needed to keep the width of the PID/TID output consistent, and
I forgot to add it when I widened the output for IRIX PIDs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998, 1999, 2000 by Iowa State University
4  *
5  * Original Authors:
6  *   Allen Bierbaum, Christopher Just,
7  *   Patrick Hartling, Kevin Meinert,
8  *   Carolina Cruz-Neira, Albert Baker
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  *
25  * -----------------------------------------------------------------
26  * File:          $RCSfile$
27  * Date modified: $Date$
28  * Version:       $Revision$
29  * -----------------------------------------------------------------
30  *
31  *************** <auto-copyright.pl END do not edit this line> ***************/
32
33
34 #include <vjConfig.h>
35 #include <Threads/vjThread.h>
36 #include <Threads/vjBaseThread.h>
37 #include <Threads/vjThreadManager.h>
38
39 int32_t vjBaseThread::mNextThreadId = 0;
40
41         // ---- Ouput operator ---- //
42 std::ostream& operator<<(std::ostream& out, vjBaseThread* threadPtr)
43 {
44    if(threadPtr != NULL)
45       threadPtr->outStream(out);
46    else
47       out << " TID: N/A  ";
48
49    return out;
50 }
51
52 //: After the object has been created, call this routine to complete initialization.
53 // Done this way, because I need to call this based on stuff that happens
54 // in derived class's constructor... and that means what???
55 //! PRE: The thread manager should be lock()'ed before calling this function so that the
56 //+       addThread function can execute correctly
57 //! POST: Thread is setup correctly to run
58 //+       The thread has been registered with the system
59 //! ARGS: successfulCreation - Did the thread get created correctly
60 void vjBaseThread::registerThread(bool succesfulCreation)
61 {
62    if(succesfulCreation)   // Success
63    {
64       create_thread_id();
65       vjThreadManager::instance()->addThread(this);      // Add the thread to the table
66    }
67    else
68    {
69       mThreadId = -1;      // We have an invalid thread
70    }
71 }
Note: See TracBrowser for help on using the browser.