What is a thread?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/04/2008 at 11:39, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.5 
Platform:      Mac OSX  ; 
Language(s) :

---------
Hi, I have a question about threads.

What is a thread? Yes, I should know it before developing a plugin ;).

Today my plugin begins to freeze cause C4D waits for the result of a calculation from an external application. In which case is it useful to create a thread?

It's correct that a thread get a seperat stream for storage and the processor? Should a new thread solve my problem?

Thx4help 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/04/2008 at 10:52, xxxxxxxx wrote:

Hi!

I red a lot of things about thrads and I think a thread could solve my problem. Does someone now where in the SDK or documentation I am able to find an example?

I have 3-4 commands that I have to put in a seperat SingleThread. The synchronisation is required when the commands are finished, like a return value.

But I don't know how.

I found the MPthread in the SDK, but it's not the right thing I am looking for.

Bye 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/04/2008 at 15:26, xxxxxxxx wrote:

Hi,

I would recommend looking on the example source files which comes with the SDK, e. g. gui/menutest.cpp.

Cheers.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/04/2008 at 22:07, xxxxxxxx wrote:

Hi! MnuTest is for Multiprocessing Threads.
I thought I have to look for the Thread class, and not for the MPThread!?

Thanks

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/04/2008 at 22:58, xxxxxxxx wrote:

For Multiprocessing threads (which are parallel on multi-processor systems), use MPThread. This would be mainly useful for rendering and won't be of any use on a single-processor system (you can't do multiprocessing threads here).

For single-process threading in Cinema 4D, use a class derived from Thread. These can be used regardless of number of actual processors/cores.

There are no examples (as far as I know) in the cinema4dsdk plugins folder. There is, though, much information here (a Search of "Thread" by Message Body yields 27 pages). I realize that wouldn't be as good as an example but there are probably some of these messages with code one would hope.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/04/2008 at 23:08, xxxxxxxx wrote:

Hi!

Yes, thanks, that's the problem I found with the difference between MPThreads and SingleThreads. I have to use it for calculations in Xpressonodes, so MPThreads aren't the code-lines I need.

Thanks for help. I try a search.

P.S: If somebody has some code examples, I would be pleased to get some code-snippets... Thanks 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/04/2008 at 23:48, xxxxxxxx wrote:

Hi!

I found some code lines, could they be correct? I create a new class at first with constructor thread

> `

  
\>  class CacheThread : public Thread {  
\>         
\>       public:  
\>            CacheThread() {  
\>            }  
\>              
\>            virtual void Main(void) {  
\>                           /* The code I want to run in seperat thread*/  
\>            }  
\>              
\>            virtual Bool TestDBreak(void) {  
\>            }  
\>              
\>            virtual const CHAR* GetThreadName(void) {  
\>                 return "test";  
\>            }  
\>  };

`

Where do I have to create this class now? I tried to call it when the code is needed.

CacheThread ct;
               ct.Start(TRUE,THREADPRIORITY_NORMAL);
               ct.End();     
               ct.Wait(false);

But C4D crashes ever and anon... 😞