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