~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to libraries/libldap_r/thr_debug.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-09-07 13:41:10 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20090907134110-jsdrvn0atu1fex4m
Tags: upstream-2.4.18
ImportĀ upstreamĀ versionĀ 2.4.18

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* thr_debug.c - wrapper around the chosen thread wrapper, for debugging. */
2
 
/* $OpenLDAP: pkg/ldap/libraries/libldap_r/thr_debug.c,v 1.5.2.7 2009/01/22 00:00:56 kurt Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/libraries/libldap_r/thr_debug.c,v 1.5.2.8 2009/08/02 22:07:31 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
5
 * Copyright 2005-2009 The OpenLDAP Foundation.
555
555
        int detached )
556
556
{
557
557
        ldap_debug_thread_t *t;
 
558
 
558
559
        if( thread_info_used >= thread_info_size ) {
559
560
                unsigned int more = thread_info_size + 8;
560
561
                unsigned int new_size = thread_info_size + more;
 
562
 
561
563
                t = calloc( more, sizeof(ldap_debug_thread_t) );
562
564
                assert( t != NULL );
563
565
                thread_info = realloc( thread_info, new_size * sizeof(*thread_info) );
564
566
                assert( thread_info != NULL );
565
 
                while( thread_info_size < new_size ) {
 
567
                do {
566
568
                        t->idx = thread_info_size;
567
569
                        thread_info[thread_info_size++] = t++;
568
 
                }
 
570
                } while( thread_info_size < new_size );
569
571
        }
 
572
 
570
573
        t = thread_info[thread_info_used];
571
574
        init_usage( &t->usage, msg );
572
575
        t->wrapped = *thread;
779
782
        if( !options_done )
780
783
                get_options();
781
784
        ERROR_IF( !threading_enabled, "ldap_pvt_thread_create" );
 
785
 
782
786
        if( wrap_threads ) {
783
787
                ldap_debug_thread_call_t *call = malloc(
784
788
                        sizeof( ldap_debug_thread_call_t ) );
843
847
                                remove_thread_info( t, "ldap_pvt_thread_join" ) );
844
848
                adjust_count( Idx_unjoined_thread, -1 );
845
849
        }
 
850
 
846
851
        return rc;
847
852
}
848
853