You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by dr...@apache.org on 2003/11/23 20:43:40 UTC

cvs commit: apr/threadproc/beos thread.c

dreid       2003/11/23 11:43:40

  Modified:    threadproc/beos thread.c
  Log:
  Fix the apr_thread_once_init so it works and allow the thread test to not
  segfault.
  Some other small pieces of cleanup and reformatting to make the code easier
  to read.
  
  Revision  Changes    Path
  1.36      +9 -4      apr/threadproc/beos/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/beos/thread.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- thread.c	6 Jan 2003 23:44:37 -0000	1.35
  +++ thread.c	23 Nov 2003 19:43:40 -0000	1.36
  @@ -122,7 +122,11 @@
           return stat;
       }
   
  -    (*new)->td = spawn_thread((thread_func)dummy_worker, "apr thread", temp, (*new));
  +    (*new)->td = spawn_thread((thread_func)dummy_worker, 
  +                              "apr thread", 
  +                              temp, 
  +                              (*new));
  +
       /* Now we try to run it...*/
       if (resume_thread((*new)->td) == B_NO_ERROR) {
           return APR_SUCCESS;
  @@ -154,7 +158,8 @@
   APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd)
   {
       status_t rv = 0, ret;
  -    if ((ret = wait_for_thread(thd->td, &rv)) == B_NO_ERROR) {
  +    ret = wait_for_thread(thd->td, &rv);
  +    if (ret == B_NO_ERROR) {
           *retval = rv;
           return APR_SUCCESS;
       }
  @@ -235,9 +240,9 @@
       *control = (apr_thread_once_t *)apr_pcalloc(p, sizeof(apr_thread_once_t));
       (*control)->hit = 0; /* we haven't done it yet... */
       rc = ((*control)->sem = create_sem(1, "thread_once"));
  -    if (rc != 0) {
  +    if (rc < 0)
           return rc;
  -    }
  +
       apr_pool_cleanup_register(p, control, thread_once_cleanup, apr_pool_cleanup_null);
       return APR_SUCCESS;
   }