/[LeafOK_CVS]/lbbs/src/test_section_list.c
ViewVC logotype

Diff of /lbbs/src/test_section_list.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.23 by sysadm, Mon May 26 03:20:39 2025 UTC Revision 1.25 by sysadm, Mon May 26 23:38:11 2025 UTC
# Line 210  int main(int argc, char *argv[]) Line 210  int main(int argc, char *argv[])
210                  // printf("Loaded %d articles into section %d\n", p_section[i]->article_count, i);                  // printf("Loaded %d articles into section %d\n", p_section[i]->article_count, i);
211          }          }
212    
213            if (last_aid != article_block_last_aid())
214            {
215                    printf("last_aid != %d\n", article_block_last_aid());
216            }
217    
218          last_aid = 0;          last_aid = 0;
219    
220          for (j = 0; j < BBS_article_limit_per_section; j++)          for (j = 0; j < BBS_article_limit_per_section; j++)
# Line 910  int main(int argc, char *argv[]) Line 915  int main(int argc, char *argv[])
915                  }                  }
916          }          }
917    
918            printf("Testing #6 ...\n");
919    
920            for (i = 0; i < section_count; i++)
921            {
922                    if (section_list_rd_lock(p_section[i]) < 0)
923                    {
924                            printf("section_list_rd_lock(sid = %d) error\n", p_section[i]->sid);
925                            break;
926                    }
927            }
928    
929            printf("Try rw_lock for 5 sec...\n");
930            if (section_list_try_rw_lock(NULL, 5) == 0)
931            {
932                    printf("section_list_try_rw_lock(sid = %d) error, expectation is timeout\n", p_section[i]->sid);
933            }
934    
935            for (i = 0; i < section_count; i++)
936            {
937                    if (section_list_rd_unlock(p_section[i]) < 0)
938                    {
939                            printf("section_list_rd_unlock(sid = %d) error\n", p_section[i]->sid);
940                            break;
941                    }
942            }
943    
944            if (section_list_try_rw_lock(NULL, 5) < 0)
945            {
946                    printf("section_list_rd_lock(sid = %d) error\n", p_section[i]->sid);
947            }
948    
949            for (i = 0; i < section_count; i++)
950            {
951                    if (section_list_try_rd_lock(p_section[i], 0) == 0)
952                    {
953                            printf("section_list_try_rd_lock(sid = %d) error, expectation is timeout\n", p_section[i]->sid);
954                            break;
955                    }
956            }
957    
958            if (section_list_rw_unlock(NULL) < 0)
959            {
960                    printf("section_list_rw_unlock(sid = %d) error\n", p_section[i]->sid);
961            }
962    
963          printf("Press ENTER to exit...");          printf("Press ENTER to exit...");
964          getchar();          getchar();
965    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1