Closed Bug 423633 Opened 17 years ago Closed 2 years ago

nsComponentManager/nsGenericModule/nsGenericFactory aren't quite threadsafe

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: timeless, Unassigned)

References

Details

Attachments

(1 file)

component manager (threadsafe [by contract]) exposes nsIFactories via: f=Components.manager.getClassObjectByContractID("@mozilla.org/storage/service;1",Components.interfaces.nsIFactory); the standard nsIFactory is: nsGenericFactory (threadsafe [by contract]) that comes from: nsGenericModule (threadsafe [by contract]) unfortunately it's possible to call f.createInstance() from multiple threads and if mConstructor isn't threadsafe (and making it threadsafe seems like an unreasonable burden) this does make a few changes: 1. you're only allowed to call SetComponentInfo once (currently the code lets you try to call it multiple times, although the results are not threadsafe) 2. you can't recursively use nsGenericFactory::CreateInstance, doing this makes absolutely no sense, and supporting it is expensive. the locks for nsGenericFactory are only created/used if the component is marked as threadsafe. This should hopefully speed the fast path and save on allocations (although having mBusy+mLock isn't quite free). the locks for nsGenericModule are always used
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: timeless → nobody
Status: ASSIGNED → NEW

nsGenericFactory no longer exists.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: