Thread: Thread calling convention

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Thread calling convention

    Having have a little problem where I can call a thread- creation function in a procedural program but not from within a class?


    Code:
    
    #include <include.h>
    #include <windows.h>
    
    
    THREADFUNC foo(char* buff )
    {
    int len = strlen(buff);
    int i, j;
    for(j = 0; j < 3; j++)
     {
      for(i = 0; i < len; i++)
       {
        PrintCtr("Buff[%i]: %c", i, buff[i]);
       }
     Sleep(1000);
     }
    }
    
    
    
    
    
    
    
    
    int main()
    {
    
    char b[] = "One";
    char c[] = "Two";
    
    THREAD t = NULL;
    THREAD v = NULL;
    
    
    
     halt();
    
     t = NewThread( foo, b );
     v = NewThread( foo, c );
    
    
    
     while(ThreadIsActive(t) && ThreadIsActive(v) );  //...wait...
    
    
     CloseHandle(t);
     CloseHandle(v);
    
    
    
      return 0;
    }
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    wouldn't this go under the c++ board?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. user thread library
    By Eran in forum C Programming
    Replies: 4
    Last Post: 06-17-2008, 01:44 AM
  2. problem calling a function from a thread
    By BrownB in forum Windows Programming
    Replies: 8
    Last Post: 12-13-2007, 07:55 PM
  3. [code] Win32 Thread Object
    By Codeplug in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2005, 03:55 PM
  4. Thread
    By bigSteve in forum C++ Programming
    Replies: 1
    Last Post: 07-27-2003, 02:36 AM
  5. VB Calling Convention?!
    By minime6696 in forum Windows Programming
    Replies: 6
    Last Post: 03-27-2002, 04:39 PM