<?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>242690</bug_id>
          
          <creation_ts>2022-07-13 07:49:31 -0700</creation_ts>
          <short_desc>[WTF] Ensure isMainThread semantics for Linux match Apple/BSD semantics</short_desc>
          <delta_ts>2022-08-01 09:39:29 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Template Framework</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=243401</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="James Hilliard">james.hilliard1</reporter>
          <assigned_to name="Adrian Perez">aperez</assigned_to>
          <cc>aperez</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1882994</commentid>
    <comment_count>0</comment_count>
    <who name="James Hilliard">james.hilliard1</who>
    <bug_when>2022-07-13 07:49:31 -0700</bug_when>
    <thetext>It&apos;s not entirely clear if the current implementation semantics are fully identical between Linux and Apple/BSD systems. The Apple/BSD pthread_main_np function has 3 potential return values, 1 if the thread is the initial thread, 0 if it is not or -1 if thread is not initialized/unknown, lets make sure we only return true for isMainThread if the return for pthread_main_np is 1. On linux checking if we are on the initial thread can be accomplished by checking the equality of getpid and gettid. Note we use a syscall for calling gettid as the gettid() libc function may not be guaranteed to be supported by all libc&apos;s on Linux unlike the syscall(which is also used elsewhere in WebKit).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1882998</commentid>
    <comment_count>1</comment_count>
    <who name="James Hilliard">james.hilliard1</who>
    <bug_when>2022-07-13 07:53:49 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/2363</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1883941</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-07-14 18:43:54 -0700</bug_when>
    <thetext>Committed 252485@main (50d7bfe855ca): &lt;https://commits.webkit.org/252485@main&gt;

Reviewed commits have been landed. Closing PR #2363 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1883942</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-14 18:44:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/97048055&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1885032</commentid>
    <comment_count>4</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-07-19 00:36:42 -0700</bug_when>
    <thetext>Reopening to address Darin&apos;s comment about usage of pthread_main_np() here:

  https://github.com/WebKit/WebKit/commit/50d7bfe855ca043cc72ec09b3d3d75100015101b#r78597817</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1885035</commentid>
    <comment_count>5</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-07-19 00:49:21 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/2536</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1885081</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-07-19 08:01:14 -0700</bug_when>
    <thetext>Committed 252601@main (0307ab9b687a): &lt;https://commits.webkit.org/252601@main&gt;

Reviewed commits have been landed. Closing PR #2536 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1888086</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-08-01 09:39:29 -0700</bug_when>
    <thetext>Regression: bug #243401</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>