6 void* print_message_function (void *ptr
);
8 int main (int argc
, char **argv
)
11 DbRetVal rv
= conn
.open("root","manager");
12 printf ("Main open Returned %d\n", rv
);
13 pthread_t thread1
, thread2
;
18 pthread_create (&thread1
, NULL
,
19 &print_message_function
, (void *) &message1
);
20 pthread_create (&thread2
, NULL
,
21 &print_message_function
, (void *) &message2
);
23 pthread_join(thread1
, (void **)&status
);
24 pthread_join(thread2
, (void **)&status
);
27 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
28 if (dbMgr
== NULL
) { printf("Auth failed\n"); return NULL
;}
29 dbMgr
->dropTable("T1");
30 dbMgr
->dropTable("T2");
33 printf ("Main Returned %d\n", rv
);
38 void* print_message_function(void *ptr
)
40 //if (flag == 0) {flag =1; sleep(2); }
42 sprintf(tblname
, "T%d", *(int*)ptr
);
44 DbRetVal rv
=conn
.open("root","manager");
45 printf("Thread Return value of open %d %d\n", rv
, getpid());
50 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
51 if (dbMgr
== NULL
) { printf("Auth failed\n"); return NULL
;}
55 tabDef
.addField("f1", typeInt
);
56 tabDef
.addField("f2", typeInt
);
57 rv
= dbMgr
->createTable(tblname
, tabDef
);
58 if (rv
!= OK
) { printf("Table creation failed\n"); return NULL
; }
59 printf("Table created\n");
62 printf("Thread Return value of close %d %d\n", rv
, getpid());