WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
67385
Don't use MainThread in JSC
https://bugs.webkit.org/show_bug.cgi?id=67385
Summary
Don't use MainThread in JSC
Patrick R. Gansterer
Reported
2011-09-01 03:48:58 PDT
Don't use MainThread in JSC
Attachments
Patch
(1.53 KB, patch)
2011-09-01 03:53 PDT
,
Patrick R. Gansterer
eric
: review-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Patrick R. Gansterer
Comment 1
2011-09-01 03:53:39 PDT
Created
attachment 105936
[details]
Patch
Darin Adler
Comment 2
2011-09-01 09:53:18 PDT
Gavin, do you think this change is OK?
Alexey Proskuryakov
Comment 3
2011-09-01 10:16:09 PDT
+ JSC has no concept of a MainThread. This is incorrect. JavaScriptCore must be initialized from the main thread before use, see comments in JavaScriptCore/runtime/InitializeThreading.h. What seems wrong here is that WTF exposes a separate initializeMainThread() function in addition to initializeThreading(), which also must be called from main thread.
Patrick R. Gansterer
Comment 4
2011-09-01 12:03:27 PDT
(In reply to
comment #3
)
> + JSC has no concept of a MainThread. > > This is incorrect. JavaScriptCore must be initialized from the main thread before use, see comments in JavaScriptCore/runtime/InitializeThreading.h.
Sure? AFAIK it is possible to run (and init) JSC from any thead when embedded into an other application. That's not necessary the MainThread. The only use of the MainThread is the assertion in the patch.
Alexey Proskuryakov
Comment 5
2011-09-01 12:17:10 PDT
There is certainly a comment in the header saying that it is a requirement, yes. Whether we should strive to lift that restriction is a separate question, and there are of course many things that could be improved regardless (like the mysterious separate initializeMainThread () call mentioned above). However, it won't be easy to move MainThread functionality from WTF to WebCore, because this will break nightly builds (Safari uses this functionality through WTF).
Patrick R. Gansterer
Comment 6
2011-09-01 12:38:16 PDT
(In reply to
comment #5
)
> However, it won't be easy to move MainThread functionality from WTF to WebCore, because this will break nightly builds (Safari uses this functionality through WTF).
Do you see any chance/way to move it to WebCore? On Linux the MainThread functionality isn't provided by the OS and needs an higher level library like Gtk/Qt/wx for this.
David Levin
Comment 7
2011-09-01 17:53:47 PDT
(In reply to
comment #3
)
> + JSC has no concept of a MainThread. > > This is incorrect. JavaScriptCore must be initialized from the main thread before use, see comments in JavaScriptCore/runtime/InitializeThreading.h. >
"This function must be called from the main thread. ... Darwin is an exception to this rule" --
http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/InitializeThreading.h
I think this is because JavaScriptCore may be run from any thread. (I hit this issue before that the JavaScript API doesn't require is main thread to be set.) However, I don't think this bug/patch has made the case for why MainThread shouldn't be used anywhere in WTF or why it should be moved out of WTF (but I'll admit that it is a tricky area that I messed up before -- I used isMainThread in a place where I shouldn't have).
Eric Seidel (no email)
Comment 8
2012-02-16 14:36:55 PST
Comment on
attachment 105936
[details]
Patch My understanding is that you *must* initialize JSC (and all our various hashes) on the main thread. This patch looks wrong.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug