threads_02.gm 362 B

12345678910111213141516
  1. global thread_func = function( a_name, a_count )
  2. {
  3. print( "["+a_name+"] Starting..." );
  4. for (i = 0; i < a_count; i = i + 1)
  5. {
  6. print( "["+a_name+"] iteration: " + i );
  7. };
  8. print( "["+a_name+"] Finishing..." );
  9. };
  10. print( "[0] Ready to execute..." );
  11. thread( thread_func, 1, 100 );
  12. thread( thread_func, 2, 100 );
  13. sleep(1);
  14. print( "[0] Thread created..." );