<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>125228</bug_id>
          
          <creation_ts>2013-12-04 10:45:44 -0800</creation_ts>
          <short_desc>Use ThreadingOnce class to encapsulate pthread_once functionality.</short_desc>
          <delta_ts>2014-01-06 11:55:59 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>125264</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>peavo</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>commit-queue</cc>
    
    <cc>ggaren</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>956444</commentid>
    <comment_count>0</comment_count>
    <who name="">peavo</who>
    <bug_when>2013-12-04 10:45:44 -0800</bug_when>
    <thetext>In runtime/InitializeThreading.cpp, the non-pthread version is not fully equivalent to the pthread version.
We can use the ThreadingOnce class here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956450</commentid>
    <comment_count>1</comment_count>
      <attachid>218416</attachid>
    <who name="">peavo</who>
    <bug_when>2013-12-04 10:53:31 -0800</bug_when>
    <thetext>Created attachment 218416
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956514</commentid>
    <comment_count>2</comment_count>
      <attachid>218416</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2013-12-04 12:13:46 -0800</bug_when>
    <thetext>Comment on attachment 218416
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956525</commentid>
    <comment_count>3</comment_count>
      <attachid>218416</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-12-04 12:40:31 -0800</bug_when>
    <thetext>Comment on attachment 218416
Patch

Clearing flags on attachment: 218416

Committed r160116: &lt;http://trac.webkit.org/changeset/160116&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956526</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-12-04 12:40:33 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956661</commentid>
    <comment_count>5</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-12-04 15:24:39 -0800</bug_when>
    <thetext>This is wrong. Please roll it out.

It is incorrect for WTF::ThreadingOnce to be declared static. Since we build without thread-safe statics, that declaration is not thread-safe.

Also, if statics were thread-safe, there would be no need for WTF::ThreadingOnce to contain any logic or data members: the constructor could just call the provided function, and you could rely on the compiler to ensure that the constructor was called only once.

Therefore, this patch is either meaningless or wrong, depending on your platform.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956682</commentid>
    <comment_count>6</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-12-04 15:59:00 -0800</bug_when>
    <thetext>Re-opened since this is blocked by bug 125264</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956684</commentid>
    <comment_count>7</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2013-12-04 16:00:30 -0800</bug_when>
    <thetext>We can switch to &quot;std::call_once&quot; when we move to VS2013.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>956899</commentid>
    <comment_count>8</comment_count>
    <who name="">peavo</who>
    <bug_when>2013-12-05 07:45:19 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; This is wrong. Please roll it out.
&gt; 
&gt; It is incorrect for WTF::ThreadingOnce to be declared static. Since we build without thread-safe statics, that declaration is not thread-safe.
&gt; 
&gt; Also, if statics were thread-safe, there would be no need for WTF::ThreadingOnce to contain any logic or data members: the constructor could just call the provided function, and you could rely on the compiler to ensure that the constructor was called only once.
&gt; 
&gt; Therefore, this patch is either meaningless or wrong, depending on your platform.

Thanks for catching this.
A couple of other places needs to be changed as well, I&apos;ve made bug 125305 for this.
Sorry for the inconvienience.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>964696</commentid>
    <comment_count>9</comment_count>
    <who name="">peavo</who>
    <bug_when>2014-01-06 11:55:59 -0800</bug_when>
    <thetext>This is now fixed by using std::call_once.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>218416</attachid>
            <date>2013-12-04 10:53:31 -0800</date>
            <delta_ts>2013-12-04 12:40:31 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-125228-20131204195257.patch</filename>
            <type>text/plain</type>
            <size>1832</size>
            <attacher>peavo</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTYwMTA0KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDEzIEBA
CisyMDEzLTEyLTA0ICBwZWF2b0BvdXRsb29rLmNvbSAgPHBlYXZvQG91dGxvb2suY29t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nMuaD4KIAogdXNpbmcgbmFtZXNwYWNlIFdURjsKIAogbmFtZXNwYWNlIEpTQyB7
CiAKLSNpZiBPUyhEQVJXSU4pCi1zdGF0aWMgcHRocmVhZF9vbmNlX3QgaW5pdGlhbGl6ZVRocmVh
ZGluZ0tleU9uY2UgPSBQVEhSRUFEX09OQ0VfSU5JVDsKLSNlbmRpZgotCiBzdGF0aWMgdm9pZCBp
bml0aWFsaXplVGhyZWFkaW5nT25jZSgpCiB7CiAgICAgV1RGOjpkb3VibGVfY29udmVyc2lvbjo6
aW5pdGlhbGl6ZSgpOwpAQCAtNzYsMTUgKzczLDggQEAgc3RhdGljIHZvaWQgaW5pdGlhbGl6ZVRo
cmVhZGluZ09uY2UoKQogCiB2b2lkIGluaXRpYWxpemVUaHJlYWRpbmcoKQogewotI2lmIE9TKERB
UldJTikKLSAgICBwdGhyZWFkX29uY2UoJmluaXRpYWxpemVUaHJlYWRpbmdLZXlPbmNlLCBpbml0
aWFsaXplVGhyZWFkaW5nT25jZSk7Ci0jZWxzZQotICAgIHN0YXRpYyBib29sIGluaXRpYWxpemVk
VGhyZWFkaW5nID0gZmFsc2U7Ci0gICAgaWYgKCFpbml0aWFsaXplZFRocmVhZGluZykgewotICAg
ICAgICBpbml0aWFsaXplVGhyZWFkaW5nT25jZSgpOwotICAgICAgICBpbml0aWFsaXplZFRocmVh
ZGluZyA9IHRydWU7Ci0gICAgfQotI2VuZGlmCisgICAgc3RhdGljIFdURjo6VGhyZWFkaW5nT25j
ZSBpbml0aWFsaXplVGhyZWFkaW5nS2V5T25jZTsKKyAgICBpbml0aWFsaXplVGhyZWFkaW5nS2V5
T25jZS5jYWxsT25jZShpbml0aWFsaXplVGhyZWFkaW5nT25jZSk7CiB9CiAKIH0gLy8gbmFtZXNw
YWNlIEpTQwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>