6 void* print_message_function (void *ptr
);
8 int main (int argc
, char **argv
)
11 DbRetVal rv
= conn
.open("praba","manager");
12 if (rv
!= 0) return 1;
13 pthread_t thread1
, thread2
;
14 char *message1
= "Thread 1";
15 char *message2
= "Thread 2";
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
);
26 if (rv
!= 0) return 1;
31 void* print_message_function(void *ptr
)
33 if (flag
== 0) {flag
=1; sleep(2); }
35 DbRetVal rv
=conn
.open("praba","manager");
38 printf("Thread Return value of open %d %d\n", rv
, getpid());
41 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
42 if (dbMgr
== NULL
) { printf("Auth failed\n"); return NULL
;}
46 tabDef
.addField("f1", typeInt
, 0, NULL
, true, true);
47 tabDef
.addField("f2", typeInt
);
48 rv
= dbMgr
->createTable("t1", tabDef
);
49 if (rv
!= OK
) { printf("Table creation failed\n"); return NULL
; }
50 printf("Table created\n");
53 if (rv
!= OK
) { printf("Thread Return value of close %d %d\n", rv
, getpid()); }