Files
clang-p2996/lldb/test/functionalities/thread/thread_specific_break/main.c
Todd Fiala a475693947 Fix bug in Linux remote dynamic loader setup and fix test.
Part 1 changes PlatformLinux::CreateInstance to always create with
is_host=false; that method is only used as the plug-in creator method
associated with the remote-linux platform plugin, and should therefore
always be remote.

Part 1 patch by Steve Pucci.

Part 2: fix a test break on linux.

In test/functionalities/thread/thread_specific_break, when using gcc,
either C99 mode would need to be enabled, or the code would need to
change.  I changed a couple loop variable definitions to conform
to pre-C99 to simplify testing the fix.  The second issue was
the necessity to include -lpthread as a linker option in the Makefile.

Any issues with that part are due to me (Todd Fiala).

llvm-svn: 199426
2014-01-16 21:22:11 +00:00

40 lines
589 B
C

#include <pthread.h>
#include <unistd.h>
void *
thread_function (void *thread_marker)
{
int keep_going = 1;
int my_value = *((int *)thread_marker);
int counter = 0;
while (counter < 20)
{
counter++; // Break here in thread body.
usleep (10);
}
return NULL;
}
int
main ()
{
pthread_t threads[10];
int thread_value = 0;
int i;
for (i = 0; i < 10; i++)
{
thread_value += 1;
pthread_create (&threads[i], NULL, &thread_function, &thread_value);
}
for (i = 0; i < 10; i++)
pthread_join (threads[i], NULL);
return 0;
}