|
@@ -22,6 +22,8 @@
|
|
|
|
|
|
|
|
ThreadSimpleImpl *volatile ThreadSimpleImpl::_st_this;
|
|
ThreadSimpleImpl *volatile ThreadSimpleImpl::_st_this;
|
|
|
|
|
|
|
|
|
|
+int ThreadSimpleImpl::_next_unique_id = 1;
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ThreadSimpleImpl::Constructor
|
|
// Function: ThreadSimpleImpl::Constructor
|
|
|
// Access: Public
|
|
// Access: Public
|
|
@@ -31,6 +33,9 @@ ThreadSimpleImpl::
|
|
|
ThreadSimpleImpl(Thread *parent_obj) :
|
|
ThreadSimpleImpl(Thread *parent_obj) :
|
|
|
_parent_obj(parent_obj)
|
|
_parent_obj(parent_obj)
|
|
|
{
|
|
{
|
|
|
|
|
+ _unique_id = _next_unique_id;
|
|
|
|
|
+ ++_next_unique_id;
|
|
|
|
|
+
|
|
|
_status = S_new;
|
|
_status = S_new;
|
|
|
_joinable = false;
|
|
_joinable = false;
|
|
|
_time_per_epoch = 0.0;
|
|
_time_per_epoch = 0.0;
|
|
@@ -157,6 +162,24 @@ preempt() {
|
|
|
_manager->preempt(this);
|
|
_manager->preempt(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: ThreadSimpleImpl::get_unique_id
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description:
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+string ThreadSimpleImpl::
|
|
|
|
|
+get_unique_id() const {
|
|
|
|
|
+ ostringstream strm;
|
|
|
|
|
+#ifdef WIN32
|
|
|
|
|
+ strm << GetCurrentProcessId();
|
|
|
|
|
+#else
|
|
|
|
|
+ strm << getpid();
|
|
|
|
|
+#endif
|
|
|
|
|
+ strm << "." << _unique_id;
|
|
|
|
|
+
|
|
|
|
|
+ return strm.str();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ThreadSimpleImpl::prepare_for_exit
|
|
// Function: ThreadSimpleImpl::prepare_for_exit
|
|
|
// Access: Public, Static
|
|
// Access: Public, Static
|