<?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 ThreadedDeviceNode + deleting nodes? in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/threadeddevicenode-deleting-nodes/m-p/5787085#M13793</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've created a ThreadedDeviceNode in order to communicate with some outside processes via a socket. This all works fine, however I need to somehow ensure that only one of these nodes is active at one time, due to the socket not being allowed to be shared.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, upon deleting the node in the Node Editor or Hypergraph, it doesn't seem to call its destructor and it therefore stays alive somewhere, preventing me from creating another node to use the socket...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- How can I ensure a single active node? Is there a way to 'activate' and 'deactivate' multiple nodes based on the status of nodes of the same type? I.e. if I had 4 SocketNodes, is there a way to ensure that only one of them uses the socket and to toggle / disable connections from the others? Unfortunately, using other ports is not an option...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- How can I ensure that a node is completely destroyed when I delete it? Apart from setting 'isDone(true)' and waiting for the next round in the thread loop, I can't find a 'join' method or other way to force a thread to terminate...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be much appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
    <pubDate>Thu, 01 Oct 2015 03:07:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-10-01T03:07:17Z</dc:date>
    <item>
      <title>ThreadedDeviceNode + deleting nodes?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/threadeddevicenode-deleting-nodes/m-p/5787085#M13793</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've created a ThreadedDeviceNode in order to communicate with some outside processes via a socket. This all works fine, however I need to somehow ensure that only one of these nodes is active at one time, due to the socket not being allowed to be shared.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, upon deleting the node in the Node Editor or Hypergraph, it doesn't seem to call its destructor and it therefore stays alive somewhere, preventing me from creating another node to use the socket...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- How can I ensure a single active node? Is there a way to 'activate' and 'deactivate' multiple nodes based on the status of nodes of the same type? I.e. if I had 4 SocketNodes, is there a way to ensure that only one of them uses the socket and to toggle / disable connections from the others? Unfortunately, using other ports is not an option...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- How can I ensure that a node is completely destroyed when I delete it? Apart from setting 'isDone(true)' and waiting for the next round in the thread loop, I can't find a 'join' method or other way to force a thread to terminate...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be much appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 03:07:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/threadeddevicenode-deleting-nodes/m-p/5787085#M13793</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-01T03:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: ThreadedDeviceNode + deleting nodes</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/threadeddevicenode-deleting-nodes/m-p/5790819#M13794</link>
      <description>&lt;P&gt;Hi tsvilans,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think when you deleting a MPxThreadedDeviceNode, it should be moved to a undo/redo queue first. Therefore the destructor is not called until it is removed from the queue. However, it will call threadShutdownHandler(), so you can put your clean code there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About to restrict single node is actived, I think you can try to create a semaphore to limit the usage of your socket resource. I've tried it with the randomizerThread sample in our devkit: After adding a semaphore, I can make only one block is moving at&amp;nbsp;the same time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2015 08:44:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/threadeddevicenode-deleting-nodes/m-p/5790819#M13794</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2015-08-27T08:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: ThreadedDeviceNode + deleting nodes</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/threadeddevicenode-deleting-nodes/m-p/5792724#M13795</link>
      <description>Thanks, Li! I will give it a shot. I'm using Boost for the socket so I will look into how that can be done.</description>
      <pubDate>Fri, 28 Aug 2015 08:57:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/threadeddevicenode-deleting-nodes/m-p/5792724#M13795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-28T08:57:38Z</dc:date>
    </item>
  </channel>
</rss>

