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

Revision 7539, 2.8 kB (checked in by anonymous, 7 years ago)

This commit was manufactured by cvs2svn to create tag
'RELENG_1_0_5_RELEASE'.

  • 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 //:
35
36 #include <vjConfig.h>
37 #include <Threads/vjThreadFunctor.h>
38 #include <Threads/vjThreadManager.h>
39
40
41 //--------------------------------------------
42 // This is the actual function that is called.
43 //--------------------------------------------
44 #if defined(VJ_IRIX_SPROC)      /* ---- Using IRIX Sproc ------ */
45     void
46     ThreadFunctorFunction (void* args) {
47         vjBaseThreadFunctor& func = *(vjBaseThreadFunctor*)args;
48         func(); // Call the functor's operator ()
49     }
50 #elif defined(VJ_OS_Win32)      /* ----- Using Win32 ---- */
51     unsigned int __stdcall
52     ThreadFunctorFunction (void* args) {
53          vjBaseThreadFunctor& func = *(vjBaseThreadFunctor*)args;
54          func();
55          return 0;
56     }
57 #elif defined(VJ_USE_PTHREADS)
58 #   ifdef _PTHREADS_DRAFT_4
59         void
60 #   else
61         void*
62 #   endif
63         ThreadFunctorFunction (void* args) {
64             vjThreadManager* vj_tm_inst;
65             vjBaseThreadFunctor& func = *((vjBaseThreadFunctor*) args);
66
67             // Wait until this thread has been registered with the thread
68             // manager before continuing execution.
69             vj_tm_inst = vjThreadManager::instance();
70             vj_tm_inst->lock();
71             vj_tm_inst->unlock();
72
73             func();
74
75 #   ifdef _PTHREADS_DRAFT_10
76             return (void*) NULL;
77 #   endif
78         }
79
80 #else
81     void
82     ThreadFunctorFunction (void* args) {
83         vjBaseThreadFunctor& func = *(vjBaseThreadFunctor*)args;
84         func();
85     }
86 #endif  /* VJ_IRIX_SPROC */
Note: See TracBrowser for help on using the browser.