| 910 |
} |
} |
| 911 |
} |
} |
| 912 |
|
|
| 913 |
|
printf("Testing #6 ...\n"); |
| 914 |
|
|
| 915 |
|
for (i = 0; i < section_count; i++) |
| 916 |
|
{ |
| 917 |
|
if (section_list_rd_lock(p_section[i]) < 0) |
| 918 |
|
{ |
| 919 |
|
printf("section_list_rd_lock(sid = %d) error\n", p_section[i]->sid); |
| 920 |
|
break; |
| 921 |
|
} |
| 922 |
|
} |
| 923 |
|
|
| 924 |
|
printf("Try rw_lock for 5 sec...\n"); |
| 925 |
|
if (section_list_try_rw_lock(NULL, 5) == 0) |
| 926 |
|
{ |
| 927 |
|
printf("section_list_try_rw_lock(sid = %d) error, expectation is timeout\n", p_section[i]->sid); |
| 928 |
|
} |
| 929 |
|
|
| 930 |
|
for (i = 0; i < section_count; i++) |
| 931 |
|
{ |
| 932 |
|
if (section_list_rd_unlock(p_section[i]) < 0) |
| 933 |
|
{ |
| 934 |
|
printf("section_list_rd_unlock(sid = %d) error\n", p_section[i]->sid); |
| 935 |
|
break; |
| 936 |
|
} |
| 937 |
|
} |
| 938 |
|
|
| 939 |
|
if (section_list_try_rw_lock(NULL, 5) < 0) |
| 940 |
|
{ |
| 941 |
|
printf("section_list_rd_lock(sid = %d) error\n", p_section[i]->sid); |
| 942 |
|
} |
| 943 |
|
|
| 944 |
|
for (i = 0; i < section_count; i++) |
| 945 |
|
{ |
| 946 |
|
if (section_list_try_rd_lock(p_section[i], 0) == 0) |
| 947 |
|
{ |
| 948 |
|
printf("section_list_try_rd_lock(sid = %d) error, expectation is timeout\n", p_section[i]->sid); |
| 949 |
|
break; |
| 950 |
|
} |
| 951 |
|
} |
| 952 |
|
|
| 953 |
|
if (section_list_rw_unlock(NULL) < 0) |
| 954 |
|
{ |
| 955 |
|
printf("section_list_rw_unlock(sid = %d) error\n", p_section[i]->sid); |
| 956 |
|
} |
| 957 |
|
|
| 958 |
printf("Press ENTER to exit..."); |
printf("Press ENTER to exit..."); |
| 959 |
getchar(); |
getchar(); |
| 960 |
|
|