FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Database
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
January 01, 2003

Multithreaded Programming with the Command Pattern

(Page 2 of 6)
Multithreaded Programming with the Command Pattern

Listing 1 Thread creation with the CreateThread() function



#include <windows.h>

#include <iostream>

void thread_entry ()
{
  for ( int i = 10; i > 0; --i )
  {
    Sleep ( 200 );
    std::cout << "world" << std::endl;
  }
}

int main ()
{
  HANDLE thread = CreateThread ( NULL, 0,
                                 ( LPTHREAD_START_ROUTINE ) thread_entry,
                                 NULL, 0, NULL );

  for ( int i = 10; i > 0; --i )
  {
    Sleep ( 100 );
    std::cout << "hello" << std::endl;
  }

  WaitForSingleObject ( thread, INFINITE );

  return ( 0 );
}

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK