Closed Bug 1361561 Opened 4 years ago Closed 4 years ago

Add GetCurrentVirtualThread and GetCurrentPhysicalThread

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: billm, Assigned: billm)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
This change adds some functions that should be used instead of PR_GetCurrentThread. They both return a PRThread. GetCurrentPhysicalThread does exactly the same thing as PR_GetCurrentThread, but it makes it clearer what you're getting when there are cooperatively scheduled threads running.

GetCurrentVirtualThread returns the same value for all threads in a cooperative thread pool. The actual value it returns is somewhat immaterial. I kinda wonder if we should just make a new opaque type for it? Maybe a class with a single PRThread* field that would be passed around by value?

Anyway, the implementation of these two methods just calls PR_GetCurrentThread() for now. We can fix it up later to do whatever we need.
Attachment #8863939 - Flags: review?(nfroyd)
Comment on attachment 8863939 [details] [diff] [review]
patch

Review of attachment 8863939 [details] [diff] [review]:
-----------------------------------------------------------------

This works for me, thanks!  ++ for the comments as well.
Attachment #8863939 - Flags: review?(nfroyd) → review+
Pushed by wmccloskey@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d289923632be
Add GetCurrentVirtualThread function (r=froydnj)
https://hg.mozilla.org/mozilla-central/rev/d289923632be
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.