Closed Bug 1209989 Opened 9 years ago Closed 9 years ago

Implicitly attach a PRThread to native threads when first used as a PRThread in the PosixNSPR implementation

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: till, Assigned: till)

Details

Attachments

(1 file)

In Servo, JS runtimes are created inside threads that're created in Rust by the embedding, not with PR_CreateThread. This would work perfectly fine with NSPR, but it breaks with the PosixNSPR implementation because that doesn't automatically attach a PRThread in such case. Patch to change that coming up.
Comment on attachment 8667926 [details] [diff] [review]
Implicitly attach a PRThread to native threads when first used as a PRThread in the PosixNSPR implementation

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

Neat!

::: js/src/vm/PosixNSPR.cpp
@@ +140,5 @@
>  {
>      if (!gInitialized)
>          Initialize();
>  
> +    PRThread* thread = (PRThread*)pthread_getspecific(gSelfThreadIndex);

Use reinterpret_cast, please; auto on the left would be fine too, if it's too long with reinterpret_cast.
Attachment #8667926 - Flags: review?(terrence) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/3b476e0a4777fc2f0d977e7a9137f3892924ef90
Bug 1209989 - Implicitly attach a PRThread to native threads when first used as a PRThread in the PosixNSPR implementation. r=terrence
https://hg.mozilla.org/mozilla-central/rev/3b476e0a4777
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: