reinit.c 939 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* This test verifies that NSPR can be cleaned up and reinitialized. */
  6. #include "nspr.h"
  7. #include <stdio.h>
  8. int main()
  9. {
  10. PRStatus rv;
  11. fprintf(stderr, "Init 1\n");
  12. PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
  13. fprintf(stderr, "Cleanup 1\n");
  14. rv = PR_Cleanup();
  15. if (rv != PR_SUCCESS) {
  16. fprintf(stderr, "FAIL\n");
  17. return 1;
  18. }
  19. fprintf(stderr, "Init 2\n");
  20. PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
  21. fprintf(stderr, "Cleanup 2\n");
  22. rv = PR_Cleanup();
  23. if (rv != PR_SUCCESS) {
  24. fprintf(stderr, "FAIL\n");
  25. return 1;
  26. }
  27. fprintf(stderr, "PASS\n");
  28. return 0;
  29. }