8268164: Adopt cast notation for WorkerThread conversions

Reviewed-by: stefank, dholmes
This commit is contained in:
Albert Mingkun Yang 2021-06-07 08:20:39 +00:00
parent 9fc914b963
commit 58bdabcd40
4 changed files with 10 additions and 9 deletions

View file

@ -103,6 +103,15 @@ class WorkerThread: public NamedThread {
private:
uint _id;
public:
static WorkerThread* current() {
return WorkerThread::cast(Thread::current());
}
static WorkerThread* cast(Thread* t) {
assert(t->is_Worker_thread(), "incorrect cast to WorkerThread");
return static_cast<WorkerThread*>(t);
}
WorkerThread() : _id(0) { }
virtual bool is_Worker_thread() const { return true; }