<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cannot hold locks at a thread boundary in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854678#M2030</link>
    <description>Hi wml, &lt;BR /&gt;Thanks for an illustrative example ... &lt;BR /&gt;pkroy
&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/450889"&gt;William Leiserson (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;Hi Pkroy,&lt;BR /&gt;&lt;BR /&gt;This error is an indication that you are holding a lock across a spawn or sync. Cilkscreen complains about this for a couple of reasons:&lt;BR /&gt;&lt;BR /&gt;1. The thread that is running just after a spawn or sync statement is not necessarily the same one that was running beforehand. This means that the acquire() and release() functions may be called on different threads, which is not permitted on certain kinds of locks on Windows or on pthread mutexes.&lt;BR /&gt;&lt;BR /&gt;2. You can deadlock, inadvertantly. Consider the following example:&lt;BR /&gt;&lt;BR /&gt;void f (lock) {&lt;BR /&gt;acquire(lock);&lt;BR /&gt;do_work();&lt;BR /&gt;release(lock);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void g (lock) {&lt;BR /&gt;spawn f();&lt;BR /&gt;acquire(lock);&lt;BR /&gt;do_work();&lt;BR /&gt;sync;&lt;BR /&gt;release(lock);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;In this case, if the acquire() in g() is executed before the acquire() in f(), then the program will deadlock because the release() in g() cannot be executed until after f() has returned and g() has been able to sync. But f() will never return.&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;For these reasons, cilkscreen will generate an error if you are holding a lock across a spawn or sync boundary.&lt;BR /&gt;&lt;BR /&gt;-wml&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
    <pubDate>Sat, 09 Jan 2010 09:20:30 GMT</pubDate>
    <dc:creator>pkroy</dc:creator>
    <dc:date>2010-01-09T09:20:30Z</dc:date>
    <item>
      <title>Cannot hold locks at a thread boundary</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854676#M2028</link>
      <description>&lt;DIV&gt;Hi all,&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
I am using cilk++ in my application. While using cilkscreen i get the following message :
&lt;DIV&gt;Cannot hold locks at a thread boundary&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;What does it mean ???&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I am doing something like this :&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;void my_Recursive_fn()&lt;/DIV&gt;
&lt;DIV&gt;{&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;if ( base_case){&lt;/DIV&gt;
&lt;DIV&gt;work0&lt;/DIV&gt;
&lt;DIV&gt;return;&lt;/DIV&gt;
&lt;DIV&gt;}&lt;/DIV&gt;
&lt;DIV&gt;else&lt;/DIV&gt;
&lt;DIV&gt;{&lt;/DIV&gt;
&lt;DIV&gt;work1&lt;/DIV&gt;
&lt;DIV&gt;spawn my_Recursive_fn();&lt;/DIV&gt;
&lt;DIV&gt;my_Recursive_fn();&lt;/DIV&gt;
&lt;DIV&gt;sync;&lt;/DIV&gt;
&lt;DIV&gt;}&lt;/DIV&gt;
&lt;DIV&gt;return;&lt;/DIV&gt;
&lt;DIV&gt;}&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Dec 2009 19:33:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854676#M2028</guid>
      <dc:creator>pkroy</dc:creator>
      <dc:date>2009-12-23T19:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot hold locks at a thread boundary</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854677#M2029</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/452527"&gt;pkroy&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV&gt;Hi all,&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
I am using cilk++ in my application. While using cilkscreen i get the following message :
&lt;DIV&gt;Cannot hold locks at a thread boundary&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;What does it mean ???&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I am doing something like this :&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;void my_Recursive_fn()&lt;/DIV&gt;
&lt;DIV&gt;{&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;if ( base_case){&lt;/DIV&gt;
&lt;DIV&gt;work0&lt;/DIV&gt;
&lt;DIV&gt;return;&lt;/DIV&gt;
&lt;DIV&gt;}&lt;/DIV&gt;
&lt;DIV&gt;else&lt;/DIV&gt;
&lt;DIV&gt;{&lt;/DIV&gt;
&lt;DIV&gt;work1&lt;/DIV&gt;
&lt;DIV&gt;spawn my_Recursive_fn();&lt;/DIV&gt;
&lt;DIV&gt;my_Recursive_fn();&lt;/DIV&gt;
&lt;DIV&gt;sync;&lt;/DIV&gt;
&lt;DIV&gt;}&lt;/DIV&gt;
&lt;DIV&gt;return;&lt;/DIV&gt;
&lt;DIV&gt;}&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hi Pkroy,&lt;BR /&gt;&lt;BR /&gt;This error is an indication that you are holding a lock across a spawn or sync. Cilkscreen complains about this for a couple of reasons:&lt;BR /&gt;&lt;BR /&gt;1. The thread that is running just after a spawn or sync statement is not necessarily the same one that was running beforehand. This means that the acquire() and release() functions may be called on different threads, which is not permitted on certain kinds of locks on Windows or on pthread mutexes.&lt;BR /&gt;&lt;BR /&gt;2. You can deadlock, inadvertantly. Consider the following example:&lt;BR /&gt;&lt;BR /&gt;void f (lock) {&lt;BR /&gt; acquire(lock);&lt;BR /&gt; do_work();&lt;BR /&gt; release(lock);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void g (lock) {&lt;BR /&gt;spawn f();&lt;BR /&gt; acquire(lock);&lt;BR /&gt; do_work();&lt;BR /&gt; sync;&lt;BR /&gt; release(lock);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;In this case, if the acquire() in g() is executed before the acquire() in f(), then the program will deadlock because the release() in g() cannot be executed until after f() has returned and g() has been able to sync. But f() will never return.&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;For these reasons, cilkscreen will generate an error if you are holding a lock across a spawn or sync boundary.&lt;BR /&gt;&lt;BR /&gt;-wml&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Jan 2010 20:57:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854677#M2029</guid>
      <dc:creator>William_Leiserson__I</dc:creator>
      <dc:date>2010-01-04T20:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot hold locks at a thread boundary</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854678#M2030</link>
      <description>Hi wml, &lt;BR /&gt;Thanks for an illustrative example ... &lt;BR /&gt;pkroy
&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/450889"&gt;William Leiserson (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;Hi Pkroy,&lt;BR /&gt;&lt;BR /&gt;This error is an indication that you are holding a lock across a spawn or sync. Cilkscreen complains about this for a couple of reasons:&lt;BR /&gt;&lt;BR /&gt;1. The thread that is running just after a spawn or sync statement is not necessarily the same one that was running beforehand. This means that the acquire() and release() functions may be called on different threads, which is not permitted on certain kinds of locks on Windows or on pthread mutexes.&lt;BR /&gt;&lt;BR /&gt;2. You can deadlock, inadvertantly. Consider the following example:&lt;BR /&gt;&lt;BR /&gt;void f (lock) {&lt;BR /&gt;acquire(lock);&lt;BR /&gt;do_work();&lt;BR /&gt;release(lock);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void g (lock) {&lt;BR /&gt;spawn f();&lt;BR /&gt;acquire(lock);&lt;BR /&gt;do_work();&lt;BR /&gt;sync;&lt;BR /&gt;release(lock);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;In this case, if the acquire() in g() is executed before the acquire() in f(), then the program will deadlock because the release() in g() cannot be executed until after f() has returned and g() has been able to sync. But f() will never return.&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;For these reasons, cilkscreen will generate an error if you are holding a lock across a spawn or sync boundary.&lt;BR /&gt;&lt;BR /&gt;-wml&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Jan 2010 09:20:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854678#M2030</guid>
      <dc:creator>pkroy</dc:creator>
      <dc:date>2010-01-09T09:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot hold locks at a thread boundary</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854679#M2031</link>
      <description>&lt;DIV style="margin:0px;"&gt;No problem. :)&lt;BR /&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 11 Jan 2010 14:54:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Cannot-hold-locks-at-a-thread-boundary/m-p/854679#M2031</guid>
      <dc:creator>William_Leiserson__I</dc:creator>
      <dc:date>2010-01-11T14:54:16Z</dc:date>
    </item>
  </channel>
</rss>

