10 static void read_thrd(void *obj) {
13 lock->read(readD1, readD2);
14 cout << "Read: d1 = " << *readD1 << ", d2 = " << *readD2 << endl;
17 static void write_thrd1(void *obj) {
20 cout << "Write: d1 = " << d1 << ", d2 = " << d2 << endl;
23 static void write_thrd2(void *obj) {
26 cout << "Write: d1 = " << d1 << ", d2 = " << d2 << endl;
29 int user_main(int argc, char *argv[]) {
32 thrd_create(&t1, &read_thrd, NULL);
33 thrd_create(&t2, &write_thrd1, NULL);
34 thrd_create(&t3, &write_thrd2, NULL);