Ignore:
Timestamp:
Mar 30, 2011, 2:19:06 PM (14 years ago)
Author:
dmik
Message:

testapp: threads: Modified to be able to easily reproduce the hang on SMP (by e.g. hitting Ctrl-Break before the normal program termination).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/testapp/threads/threads.c

    r21518 r21608  
    100100    } // End of main thread creation loop.
    101101
     102#ifndef _MSC_VER
     103    printf("Started %d threads. Waiting for them to terminate...\n", MAX_THREADS);
     104#endif   
     105   
    102106    // Wait until all threads have terminated.
    103107
    104108    WaitForMultipleObjects(MAX_THREADS, hThreadArray, TRUE, INFINITE);
    105109
     110#ifndef _MSC_VER
     111    printf("All threads terminated.\n");
     112#endif   
     113   
    106114    // Close all thread handles and free memory allocations.
    107115
     
    143151    // Print the parameter values using thread-safe functions.
    144152
     153    Sleep(1000 * pDataArray->val1 / 2);
     154
    145155    StringCchPrintf(msgBuf, BUF_SIZE, TEXT("Parameters = %d, %d\n"),
    146156        pDataArray->val1, pDataArray->val2);
     
    153163#endif   
    154164
     165#if 0
     166    // crash the application
     167    if (pDataArray->val1 == 6)
     168    {
     169        *((int*)0) = 0;
     170    }
     171#endif
     172
    155173    return 0;
    156174}
Note: See TracChangeset for help on using the changeset viewer.