Lines Matching +full:- +full:- +full:threads

1 // SPDX-License-Identifier: GPL-2.0
17 #include "util/synthetic-events.h"
21 #define THREADS 4 macro
32 static struct thread_data threads[THREADS]; variable
40 MAP_SHARED|MAP_ANONYMOUS, -1, 0); in thread_init()
44 return -1; in thread_init()
47 td->map = map; in thread_init()
48 td->tid = syscall(SYS_gettid); in thread_init()
50 pr_debug("tid = %d, map = %p\n", td->tid, map); in thread_init()
64 ret = write(td->ready[1], &go, sizeof(int)); in thread_fn()
75 munmap(td->map, page_size); in thread_fn()
81 struct thread_data *td = &threads[i]; in thread_create()
84 if (pipe(td->ready)) in thread_create()
85 return -1; in thread_create()
87 err = pthread_create(&td->pt, NULL, thread_fn, td); in thread_create()
90 ssize_t ret = read(td->ready[0], &go, sizeof(int)); in thread_create()
94 close(td->ready[0]); in thread_create()
95 close(td->ready[1]); in thread_create()
101 struct thread_data *td0 = &threads[0]; in threads_create()
108 return -1; in threads_create()
110 for (i = 1; !err && i < THREADS; i++) in threads_create()
118 struct thread_data *td0 = &threads[0]; in threads_destroy()
122 munmap(td0->map, page_size); in threads_destroy()
126 for (i = 1; !err && i < THREADS; i++) in threads_destroy()
127 err = pthread_join(threads[i].pt, NULL); in threads_destroy()
162 * The threads_create will not return before all threads in mmap_events()
168 TEST_ASSERT_VAL("failed to create threads", !threads_create()); in mmap_events()
178 TEST_ASSERT_VAL("failed to destroy threads", !threads_destroy()); in mmap_events()
185 for (i = 0; i < THREADS; i++) { in mmap_events()
186 struct thread_data *td = &threads[i]; in mmap_events()
190 thread = machine__findnew_thread(machine, getpid(), td->tid); in mmap_events()
192 pr_debug("looking for map %p\n", td->map); in mmap_events()
195 (unsigned long) (td->map + 1), &al); in mmap_events()
201 err = -1; in mmap_events()
205 pr_debug("map %p, addr %" PRIx64 "\n", al.map, al.map->start); in mmap_events()
214 * This test creates 'THREADS' number of threads (including
217 * When threads are created, we synthesize them with both