Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Andrew Bauer
VTK
Commits
7674a72e
Commit
7674a72e
authored
Mar 26, 1997
by
Ken Martin
Browse files
new thread flags
parent
6e7121cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
common/vtkMultiThreader.cxx
View file @
7674a72e
...
...
@@ -2,13 +2,13 @@
// These are the includes necessary for multithreaded rendering on an SGI
// using the sproc() call
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
#include
<sys/resource.h>
#include
<sys/prctl.h>
#include
<wait.h>
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
#include
<pthread.h>
#endif
...
...
@@ -28,20 +28,20 @@ vtkMultiThreader::vtkMultiThreader()
this
->
SingleMethod
=
NULL
;
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
// Default the number of threads to be the number of available
// processors if we are using sproc()
this
->
ThreadCount
=
prctl
(
PR_MAXPPROCS
);
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
// Default the number of threads to be the number of available
// processors if we are using pthreads()
this
->
ThreadCount
=
sysconf
(
_SC_NPROCESSORS_ONLN
);
#endif
#ifndef USE_SPROC
#ifndef USE_PTHREADS
#ifndef
VTK_
USE_SPROC
#ifndef
VTK_
USE_PTHREADS
// If we are not multithreading, the number of threads should
// always be 1
this
->
ThreadCount
=
1
;
...
...
@@ -92,13 +92,13 @@ void vtkMultiThreader::SetMultipleMethod( int index,
void
vtkMultiThreader
::
SingleMethodExecute
()
{
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
int
thread_loop
;
siginfo_t
info_ptr
;
int
process_id
[
VTK_MAX_THREADS
];
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
int
thread_loop
;
pthread_t
process_id
[
VTK_MAX_THREADS
];
#endif
...
...
@@ -112,7 +112,7 @@ void vtkMultiThreader::SingleMethodExecute()
// We are using sproc (on SGIs), pthreads(on Suns), or a single thread
// (the default)
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
// Using sproc() on an SGI
//
// We want to use sproc to start this->ThreadCount - 1 additional
...
...
@@ -145,7 +145,7 @@ void vtkMultiThreader::SingleMethodExecute()
}
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
// Using POSIX threads
//
// We want to use pthread_create to start this->ThreadCount - 1 additional
...
...
@@ -184,8 +184,8 @@ pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
}
#endif
#ifndef USE_SPROC
#ifndef USE_PTHREADS
#ifndef
VTK_
USE_SPROC
#ifndef
VTK_
USE_PTHREADS
// There is no multi threading, so there is only one thread.
this
->
ThreadInfoArray
[
0
].
UserData
=
this
->
SingleData
;
this
->
ThreadInfoArray
[
0
].
ThreadCount
=
this
->
ThreadCount
;
...
...
@@ -198,12 +198,12 @@ void vtkMultiThreader::MultipleMethodExecute()
{
int
thread_loop
;
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
siginfo_t
info_ptr
;
int
process_id
[
VTK_MAX_THREADS
];
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
pthread_t
process_id
[
VTK_MAX_THREADS
];
#endif
...
...
@@ -218,7 +218,7 @@ void vtkMultiThreader::MultipleMethodExecute()
// We are using sproc (on SGIs), pthreads(on Suns), or a single thread
// (the default)
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
// Using sproc() on an SGI
//
// We want to use sproc to start this->ThreadCount - 1 additional
...
...
@@ -255,7 +255,7 @@ void vtkMultiThreader::MultipleMethodExecute()
}
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
// Using POSIX threads
//
// We want to use pthread_create to start this->ThreadCount - 1 additional
...
...
@@ -291,8 +291,8 @@ void vtkMultiThreader::MultipleMethodExecute()
}
#endif
#ifndef USE_SPROC
#ifndef USE_PTHREADS
#ifndef
VTK_
USE_SPROC
#ifndef
VTK_
USE_PTHREADS
// There is no multi threading, so there is only one thread.
this
->
ThreadInfoArray
[
0
].
UserData
=
this
->
MultipleData
[
0
];
this
->
ThreadInfoArray
[
0
].
ThreadCount
=
this
->
ThreadCount
;
...
...
common/vtkMultiThreader.h
View file @
7674a72e
...
...
@@ -11,53 +11,53 @@
#include
"vtkObject.h"
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
#include
<sys/types.h>
#include
<unistd.h>
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
#include
<sys/types.h>
#include
<unistd.h>
#endif
// If USE_SPROC is defined, then sproc() will be used to create
// multiple threads on an SGI. If USE_PTHREADS is defined, then
// If
VTK_
USE_SPROC is defined, then sproc() will be used to create
// multiple threads on an SGI. If
VTK_
USE_PTHREADS is defined, then
// pthread_create() will be used to create multiple threads (on
// a sun, for example)
// The maximum number of threads allowed
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
#define VTK_MAX_THREADS 32
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
#define VTK_MAX_THREADS 32
#endif
#ifndef USE_SPROC
#ifndef USE_PTHREADS
#ifndef
VTK_
USE_SPROC
#ifndef
VTK_
USE_PTHREADS
#define VTK_MAX_THREADS 1
#endif
#endif
// If USE_SPROC is defined, then the multithreaded function is
// of type void. If USE_PTHREADS is defined, then the multithreaded
// If
VTK_
USE_SPROC is defined, then the multithreaded function is
// of type void. If
VTK_
USE_PTHREADS is defined, then the multithreaded
// function is of type void *, and returns NULL
// If neither are defined, the type is void.
#ifdef USE_SPROC
#ifdef
VTK_
USE_SPROC
typedef
void
vtkThreadFunctionType
;
#define VTK_THREAD_RETURN_TYPE
#endif
#ifdef USE_PTHREADS
#ifdef
VTK_
USE_PTHREADS
typedef
void
*
vtkThreadFunctionType
;
#define VTK_THREAD_RETURN_TYPE NULL
#endif
#ifndef USE_SPROC
#ifndef USE_PTHREADS
#ifndef
VTK_
USE_SPROC
#ifndef
VTK_
USE_PTHREADS
typedef
void
vtkThreadFunctionType
;
#define VTK_THREAD_RETURN_TYPE
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment