<?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: Create Thread in ObjectARX in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716143#M23108</link>
    <description>Yang:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; After the creation, the thread ID and Handle are returned successfully.&lt;BR /&gt;
&amp;gt; But the created thread has never run.&lt;BR /&gt;
&lt;BR /&gt;
  How are you determining that the thread hasn't executed?  Are you trying &lt;BR /&gt;
to create the thread from within your DllMain() function?&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
    <pubDate>Wed, 26 Jul 2006 21:10:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-07-26T21:10:33Z</dc:date>
    <item>
      <title>Create Thread in ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716142#M23107</link>
      <description>Dear all,&lt;BR /&gt;
&lt;BR /&gt;
I am trying to create a thread in an ObjectARX project. The function I used is &lt;BR /&gt;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFunc, NULL, 0, &amp;amp;dwThreadId).&lt;BR /&gt;
&lt;BR /&gt;
After the creation, the thread ID and Handle are returned successfully. But the created thread has never run.&lt;BR /&gt;
&lt;BR /&gt;
Can anyone tell me if there is any way to solve this problem?&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Yang</description>
      <pubDate>Wed, 26 Jul 2006 12:31:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716142#M23107</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-07-26T12:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create Thread in ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716143#M23108</link>
      <description>Yang:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; After the creation, the thread ID and Handle are returned successfully.&lt;BR /&gt;
&amp;gt; But the created thread has never run.&lt;BR /&gt;
&lt;BR /&gt;
  How are you determining that the thread hasn't executed?  Are you trying &lt;BR /&gt;
to create the thread from within your DllMain() function?&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
      <pubDate>Wed, 26 Jul 2006 21:10:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716143#M23108</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-07-26T21:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create Thread in ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716144#M23109</link>
      <description>Hi Owen,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your kindly reply. I attached the snippet of my &lt;BR /&gt;
code. I have registered a command "watch" in the command stack to activate the watchDb() method.&lt;BR /&gt;
&lt;BR /&gt;
After the CreateThread () method, I got a returned value for the thread ID and the handle.&lt;BR /&gt;
&lt;BR /&gt;
However, nothing is printed out like the first operation (print the sentence ("Already in Thread")), which makes me believe that the thread is not run. &lt;BR /&gt;
&lt;BR /&gt;
I also use a software (like Windows Task Manager)  that is able to trace all the Processes and their Threads, but the ThreadFun thread is not in the list.&lt;BR /&gt;
&lt;BR /&gt;
void watchDb ()&lt;BR /&gt;
{&lt;BR /&gt;
    if (gpDbr == NULL) {&lt;BR /&gt;
        gpDbr = new AsdkDbReactor();&lt;BR /&gt;
    }&lt;BR /&gt;
    &lt;BR /&gt;
    acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;addReactor(gpDbr);&lt;BR /&gt;
		&lt;BR /&gt;
    DWORD dwThreadId=0;&lt;BR /&gt;
   if (CreateThread(NULL, &lt;BR /&gt;
                               0,				        (LPTHREAD_START_ROUTINE)ThreadFunc,	         NULL,&lt;BR /&gt;
                              0,				         &amp;amp;dwThreadId) == NULL) &lt;BR /&gt;
	{&lt;BR /&gt;
		acutPrintf("NULL Thread\n");&lt;BR /&gt;
		return ;&lt;BR /&gt;
	}&lt;BR /&gt;
    acutPrintf("\nThread id = %d\n", dwThreadId);&lt;BR /&gt;
 }&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
void ThreadFunc () {&lt;BR /&gt;
   acutPrintf("Already in Thread\n");&lt;BR /&gt;
  ...&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot.&lt;BR /&gt;
&lt;BR /&gt;
Yang</description>
      <pubDate>Thu, 27 Jul 2006 10:05:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716144#M23109</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-07-27T10:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create Thread in ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716145#M23110</link>
      <description>From objectARX doc:&lt;BR /&gt;
&lt;BR /&gt;
"ObjectARX Does Not Support Multi-Threaded Programming&lt;BR /&gt;
If you spawn multiple threads in your application, make sure that no more than one of the threads at a time invokes anything in the ObjectARX system."</description>
      <pubDate>Thu, 27 Jul 2006 10:57:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716145#M23110</guid>
      <dc:creator>OysteinW</dc:creator>
      <dc:date>2006-07-27T10:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create Thread in ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716146#M23111</link>
      <description>From the MSDN docs for CreateThread(): "A thread in an executable that calls &lt;BR /&gt;
the C run-time library (CRT) should use the _beginthread and _endthread &lt;BR /&gt;
functions for thread management...".&lt;BR /&gt;
&lt;BR /&gt;
   Dan&lt;BR /&gt;
&lt;BR /&gt;
&lt;ZHENGY&gt; wrote in message news:5250034@discussion.autodesk.com...&lt;BR /&gt;
Hi Owen,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your kindly reply. I attached the snippet of my&lt;BR /&gt;
code. I have registered a command "watch" in the command stack to activate &lt;BR /&gt;
the watchDb() method.&lt;BR /&gt;
&lt;BR /&gt;
After the CreateThread () method, I got a returned value for the thread ID &lt;BR /&gt;
and the handle.&lt;BR /&gt;
&lt;BR /&gt;
However, nothing is printed out like the first operation (print the sentence &lt;BR /&gt;
("Already in Thread")), which makes me believe that the thread is not run.&lt;BR /&gt;
&lt;BR /&gt;
I also use a software (like Windows Task Manager)  that is able to trace all &lt;BR /&gt;
the Processes and their Threads, but the ThreadFun thread is not in the &lt;BR /&gt;
list.&lt;BR /&gt;
&lt;BR /&gt;
void watchDb ()&lt;BR /&gt;
{&lt;BR /&gt;
    if (gpDbr == NULL) {&lt;BR /&gt;
        gpDbr = new AsdkDbReactor();&lt;BR /&gt;
    }&lt;BR /&gt;
&lt;BR /&gt;
    acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;addReactor(gpDbr);&lt;BR /&gt;
&lt;BR /&gt;
    DWORD dwThreadId=0;&lt;BR /&gt;
   if (CreateThread(NULL,&lt;BR /&gt;
                               0, &lt;BR /&gt;
(LPTHREAD_START_ROUTINE)ThreadFunc,          NULL,&lt;BR /&gt;
                              0,          &amp;amp;dwThreadId) == NULL)&lt;BR /&gt;
{&lt;BR /&gt;
acutPrintf("NULL Thread\n");&lt;BR /&gt;
return ;&lt;BR /&gt;
}&lt;BR /&gt;
    acutPrintf("\nThread id = %d\n", dwThreadId);&lt;BR /&gt;
 }&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
void ThreadFunc () {&lt;BR /&gt;
   acutPrintf("Already in Thread\n");&lt;BR /&gt;
  ...&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot.&lt;BR /&gt;
&lt;BR /&gt;
Yang&lt;/ZHENGY&gt;</description>
      <pubDate>Thu, 27 Jul 2006 13:33:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716146#M23111</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-07-27T13:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create Thread in ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716147#M23112</link>
      <description>Your acutPrintf() call is not a reliable way to check whether the thread &lt;BR /&gt;
is executing, because ObjectARX API functions do not support asynchronous &lt;BR /&gt;
reentrancy.  Use something independent of AutoCAD (such OutputDebugString &lt;BR /&gt;
under a debugger) to test whether your thread is executing. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
      <pubDate>Thu, 27 Jul 2006 14:39:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716147#M23112</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-07-27T14:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create Thread in ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716148#M23113</link>
      <description>Yes, Owen, you are definitely right. I tried other approaches and found out that the created thread was running, but it could not print out anything on the AutoCAD screen using acutPrintf().&lt;BR /&gt;
&lt;BR /&gt;
Thanks for all the  replies to help me out.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Yang

Message was edited by: zhengy</description>
      <pubDate>Fri, 28 Jul 2006 06:12:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/create-thread-in-objectarx/m-p/1716148#M23113</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-07-28T06:12:03Z</dc:date>
    </item>
  </channel>
</rss>

