Panda3D
panda
src
pipeline
genericThread.h
Go to the documentation of this file.
1
/**
2
* PANDA 3D SOFTWARE
3
* Copyright (c) Carnegie Mellon University. All rights reserved.
4
*
5
* All use of this software is subject to the terms of the revised BSD
6
* license. You should have received a copy of this license along
7
* with this source code in a file named "LICENSE."
8
*
9
* @file genericThread.h
10
* @author drose
11
* @date 2011-11-09
12
*/
13
14
#ifndef GENERICTHREAD_H
15
#define GENERICTHREAD_H
16
17
#include "
pandabase.h
"
18
#include "
thread.h
"
19
20
/**
21
* A generic thread type that allows calling a C-style thread function without
22
* having to subclass.
23
*/
24
class
EXPCL_PANDA_PIPELINE
GenericThread
:
public
Thread
{
25
public
:
26
typedef
void
ThreadFunc(
void
*user_data);
27
28
GenericThread
(
const
std::string &name,
const
std::string &sync_name);
29
GenericThread
(
const
std::string &name,
const
std::string &sync_name, ThreadFunc *
function
,
void
*user_data);
30
31
INLINE
void
set_function(ThreadFunc *
function
);
32
INLINE ThreadFunc *get_function()
const
;
33
34
INLINE
void
set_user_data(
void
*user_data);
35
INLINE
void
*get_user_data()
const
;
36
37
protected
:
38
virtual
void
thread_main();
39
40
private
:
41
ThreadFunc *_function;
42
void
*_user_data;
43
44
public
:
45
static
TypeHandle
get_class_type() {
46
return
_type_handle;
47
}
48
static
void
init_type() {
49
Thread::init_type();
50
register_type
(_type_handle,
"GenericThread"
,
51
Thread::get_class_type());
52
}
53
virtual
TypeHandle
get_type()
const
{
54
return
get_class_type();
55
}
56
virtual
TypeHandle
force_init_type() {init_type();
return
get_class_type();}
57
58
private
:
59
static
TypeHandle
_type_handle;
60
};
61
62
#include "
genericThread.I
"
63
64
#endif
GenericThread
A generic thread type that allows calling a C-style thread function without having to subclass.
Definition:
genericThread.h:24
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition:
register_type.I:22
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition:
typeHandle.h:81
genericThread.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Thread
A thread; that is, a lightweight process.
Definition:
thread.h:46
thread.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Sat Jan 11 2020 15:15:30 for Panda3D by
1.8.17