Thread calling convention

This is a discussion on Thread calling convention within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Having have a little problem where I can call a thread- creation function in a procedural program but not from ...

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

    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;
    }



    ITSA
    Socket Library!

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    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, 06: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, 03:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21