pipeline: fix regression with Thread.getCurrentTask() disappearing

This method was accidentally un-exposed by 2e20a0f16ed4c08030f978e46950ba635fca8a32

Fixes #226
This commit is contained in:
rdb 2018-01-10 20:17:43 +01:00
parent dee4cd6201
commit 6a323081c0
3 changed files with 6 additions and 8 deletions

View File

@ -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.

View File

@ -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;
}
/**

View File

@ -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;