-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
It doesn't really make any sense for these objects to be shared.
They contain API methods which are only intended for the parent thread to use, such as start()
, join()
, isRunning()
, isJoined()
, etc.
The only reason a shared context object is desirable for these things is to allow Thread::run()
to get information from the parent thread.
After the initial run()
, it makes more sense to put things in static properties, rather than paying a performance penalty to access them from the thread context again and again.
Proposal:
- Make
Thread
andWorker
no longer extendThreadSafe
- Make
Thread
andWorker
becomefinal
- Make
Thread
accept aRunnable
in its__construct()
(which will be thread-safe), which it runs and then immediately shuts itself down (contrary to aWorker
, which remains running - though we could easily ditchThread
and only haveWorker
with this system) - Possibly introduce
ClosureRunnable
- Move
Thread::getCreatorId()
toRunnable::getCreatorId()
- Remove
Thread::getCurrentThread()
andThread->getThreadId()
(Thread::getCurrentThreadId()
will remain) - Add
Thread::getName()
andThread::setName()
for identification (relates to API to set thread name seen by htop etc #139)
Metadata
Metadata
Assignees
Labels
No labels