6 void* print_message_function (void *ptr
);
8 int main (int argc
, char **argv
)
11 DbRetVal rv
= conn
.open("root","manager");
12 if (rv
!= 0) return 1;
13 pthread_t thread1
, thread2
;
14 char *message1
= "Thread 1";
15 char *message2
= "Thread 2";
16 long status1
, status2
;
17 pthread_create (&thread1
, NULL
,
18 &print_message_function
, (void *) message1
);
19 pthread_create (&thread2
, NULL
,
20 &print_message_function
, (void *) message2
);
22 pthread_join(thread1
, (void **)&status1
);
23 pthread_join(thread2
, (void **)&status2
);
25 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
26 if (dbMgr
== NULL
) { printf("Auth failed \n"); conn
.close(); return NULL
; }
27 rv
= dbMgr
->dropTable("t1");
28 if ( rv
!= OK
) return 2;
30 if (rv
!= 0) return 3;
32 if( 1 == (status1
+ status2
) ) return 0;
37 void* print_message_function(void *ptr
)
39 //if (flag == 0) {flag =1; sleep(2); }
41 DbRetVal rv
=conn
.open("root","manager");
44 printf("Thread Return value of open %d %d\n", rv
, getpid());
47 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
48 if (dbMgr
== NULL
) { printf("Auth failed\n"); conn
.close(); return NULL
;}
51 tabDef
.addField("f1", typeInt
);
52 tabDef
.addField("f2", typeInt
);
53 rv
= dbMgr
->createTable("t1", tabDef
);
54 if (rv
!= OK
) { printf("Table creation failed\n"); conn
.close(); return (void*) 1; }
55 printf("Table created %d %lu\n", os::getpid(), os::getthrid());
58 if (rv
!= OK
) { printf("Thread Return value of close %d %d\n", rv
, getpid()); }