Panda3D
genericThread.cxx
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.cxx
10  * @author drose
11  * @date 2011-11-09
12  */
13 
14 #include "genericThread.h"
15 #include "pnotify.h"
16 
17 TypeHandle GenericThread::_type_handle;
18 
19 /**
20  *
21  */
22 GenericThread::
23 GenericThread(const std::string &name, const std::string &sync_name) :
24  Thread(name, sync_name)
25 {
26  _function = nullptr;
27  _user_data = nullptr;
28 }
29 
30 /**
31  *
32  */
33 GenericThread::
34 GenericThread(const std::string &name, const std::string &sync_name, GenericThread::ThreadFunc *function, void *user_data) :
35  Thread(name, sync_name),
36  _function(function),
37  _user_data(user_data)
38 {
39 }
40 
41 /**
42  * This is the thread's main execution function.
43  */
44 void GenericThread::
45 thread_main() {
46  nassertv(_function != nullptr);
47  (*_function)(_user_data);
48 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
Definition: thread.h:46
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81