64 printf(
"Adding node number %i\n", i);
73 while (root != NULL) {
74 printf(
"Data is %i\n", root->
work);
95 if (root->
next == NULL) {
96 assert(root &&
"Region root is NULL");
99 tid = (pthread_t *)malloc(
THREADS *
sizeof(pthread_t));
100 pthread_attr_init(&attr);
101 pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
103 for (i = 0; i <
THREADS; i++) {
104 printf(
"Creating thead %i\n", i);
105 pthread_create(&tid[i], &attr, (
void *(*)(
void *))
add, NULL);
109 printf(
"Waiting for threads");
111 for (i = 0; i <
THREADS; i++) {
112 pthread_join(tid[i], NULL);
Definition: region_test.h:31
node * next
Definition: region_test.h:32
#define WORK
Definition: region_test.h:26
#define THREADS
Definition: region_test.h:25
void dump()
Definition: region_test.h:72
#define NUM_NODES
Definition: region_test.h:27
node * root
Definition: region_test.h:36
void NVM_SetRegionRoot(uint32_t rid, void *root)
Set the root pointer of an existing persistent region.
Definition: pregion_mgr_api.cpp:55
uint32_t global_rgn_id
Definition: region_test.h:39
int work
Definition: region_test.h:33
void * nvm_alloc(size_t sz, uint32_t rid)
Malloc style interface for allocation from a persistent region.
Definition: pregion_mgr_api.cpp:60
void test(uint32_t rgn_id)
Definition: region_test.h:79
void nvm_free(void *ptr)
Deallocation interface for persistent data.
Definition: pregion_mgr_api.cpp:78
uint32_t rgn_id
Definition: malloc_free_test.c:22
void * NVM_GetRegionRoot(uint32_t rid)
Get the root pointer of the persistent region.
Definition: pregion_mgr_api.cpp:50
pthread_mutex_t root_lock
Definition: region_test.h:37
int num_nodes
Definition: region_test.h:38
void * add()
Definition: region_test.h:41