summaryrefslogtreecommitdiffstats
path: root/lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
blob: 14f3474789afded77ce8598e374ed76f680e53b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <pthread.h>

int g_watchme = 0;

void *thread_func(void *arg) {
  /* watchpoint trigger from subthread */
  g_watchme = 2;
  return 0;
}

int main() {
  pthread_t thread;
  if (pthread_create(&thread, 0, thread_func, 0))
    return 1;

  /* watchpoint trigger from main thread */
  g_watchme = 1;

  if (pthread_join(thread, 0))
    return 2;

  return 0;
}
OpenPOWER on IntegriCloud