Browse Source

pipeline: fix regression with Thread.getCurrentTask() disappearing

This method was accidentally un-exposed by 2e20a0f16ed4c08030f978e46950ba635fca8a32

Fixes #226
rdb 8 years ago
parent
commit
6a323081c0
3 changed files with 6 additions and 8 deletions
  1. 2 4
      panda/src/event/asyncTask.cxx
  2. 2 2
      panda/src/pipeline/thread.I
  3. 2 2
      panda/src/pipeline/thread.h

+ 2 - 4
panda/src/event/asyncTask.cxx

@@ -402,8 +402,7 @@ unlock_and_do_task() {
   nassertr(current_thread->_current_task == nullptr, DS_interrupt);
 
   void *ptr = AtomicAdjust::compare_and_exchange_ptr
-    ((void * TVOLATILE &)current_thread->_current_task,
-     (void *)nullptr, (void *)this);
+    (current_thread->_current_task, nullptr, (TypedReferenceCount *)this);
 
   // If the return value is other than nullptr, someone else must have
   // assigned the task first, in another thread.  That shouldn't be possible.
@@ -437,8 +436,7 @@ unlock_and_do_task() {
   nassertr(current_thread->_current_task == this, status);
 
   ptr = AtomicAdjust::compare_and_exchange_ptr
-    ((void * TVOLATILE &)current_thread->_current_task,
-     (void *)this, (void *)nullptr);
+    (current_thread->_current_task, (TypedReferenceCount *)this, nullptr);
 
   // If the return value is other than this, someone else must have assigned
   // the task first, in another thread.  That shouldn't be possible.

+ 2 - 2
panda/src/pipeline/thread.I

@@ -277,9 +277,9 @@ preempt() {
  * AsyncTaskManager), if any, or NULL if the thread is not currently servicing
  * a task.
  */
-INLINE AsyncTask *Thread::
+INLINE TypedReferenceCount *Thread::
 get_current_task() const {
-  return _current_task;
+  return (TypedReferenceCount *)_current_task;
 }
 
 /**

+ 2 - 2
panda/src/pipeline/thread.h

@@ -89,7 +89,7 @@ PUBLISHED:
   BLOCKING INLINE void join();
   INLINE void preempt();
 
-  INLINE AsyncTask *get_current_task() const;
+  INLINE TypedReferenceCount *get_current_task() const;
 
   INLINE void set_python_index(int index);
 
@@ -142,7 +142,7 @@ private:
   int _pipeline_stage;
   PStatsCallback *_pstats_callback;
   bool _joinable;
-  AsyncTask *_current_task;
+  AtomicAdjust::Pointer _current_task;
 
   int _python_index;