systemtap/tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.cpp
Martin Cermak 8d5d041590 Include downstream/RHEL tests
Find new home for downstream RHEL tests.  Upstream them.  The set of
tests used for fedora gating stays intact:  The gating tests are only
those having the tier1 tag set in their main.fmf file.  The testplan
plans/ci.fmf filters the others out from gating.

The set of Fedora gating tests stays the same as it was before this
change.
2022-05-10 09:56:18 +02:00

36 lines
559 B
C++

#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
int square (int x)
{
return (x * x);
}
void *my_thread(void *arg)
{
int x = 0;
int sqr;
while (true) {
sqr = square(5);
sleep(1);
}
return NULL;
}
int main()
{
pthread_t thread_id;
if (pthread_create(&thread_id, NULL, my_thread, NULL)) {
fprintf(stderr, "Error creating thread\n");
return 1;
}
if (pthread_join(thread_id, NULL)) {
fprintf(stderr, "Error joining thread\n");
return 2;
}
return 0;
}