|
From: Darius I. <da...@ge...> - 2004-07-01 15:26:52
|
On Mon, 28 Jun 2004, Tom Hughes wrote: > In message <Pin...@ba...> > Darius Ivanauskas <da...@ge...> wrote: > > > On Sun, 27 Jun 2004, Tom Hughes wrote: > > > > > The se_unmap function no longer exists as the semaphore mapping scheme > > > was changed a while ago to remove the limit on the number of semaphores. > > > > > > It sounds like a similar rework of rwlocks might be helpful to you? > > > > Yes, you are right, I think that it will be helpful not only for me :) > > Try this patch... > I tried it and results are below: ==16575== Invalid write of size 4 ==16575== at 0x34157CC0: rw_new (vg_libpthread.c:2952) ==16575== by 0x34157E20: pthread_rwlock_init (vg_libpthread.c:3023) ....<skipped>.... ==16575== Address 0xC is not stack'd, malloc'd or (recently) free'd ==16575== valgrind: vg_libpthread.c:2948 (rw_new): Assertion `res == 0' failed. ==16575== Please report this bug at: valgrind.kde.org Because I'm used patch you gave on a cvs snapshot taken ~3 days before, i'm attaching contexts for each stacktrace below. I also got the same result with current cvs snapshot :( 2952 Context: --------------------- 2940 static vg_rwlock_t* rw_new ( pthread_rwlock_t* orig ) 2941 { 2942 int res; 2943 vg_rwlock_t* rwl; 2944 vg_pthread_rwlock_t* vg_orig; 2945 CONVERT(rwlock, orig, vg_orig); 2946 2947 res = __pthread_mutex_lock(&rw_new_mx); 2948 my_assert(res == 0); 2949 2950 rwl = my_malloc(sizeof(vg_rwlock_t)); 2951 2952 vg_orig->__vg_rw_writer = rwl; 2953 vg_orig->__vg_rw_read_waiting = (void *)((Addr)rwl ^ RWLOCK_CHECK_MAGIC); 2954 2955 init_vg_rwlock(rwl); 2956 if (vg_orig->__vg_rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP) 2957 rwl->prefer_w = 0; 2958 2959 res = __pthread_mutex_unlock(&rw_new_mx); 2960 my_assert(res == 0); 2961 2962 return rwl; 2963 } ---------------------- 3023 Context: ------------------ 3007 int pthread_rwlock_init ( pthread_rwlock_t* orig, 3008 const pthread_rwlockattr_t* attr ) 3009 { 3010 vg_rwlock_t* rwl; 3011 vg_pthread_rwlock_t* vg_orig; 3012 vg_pthread_rwlockattr_t* vg_attr; 3013 CONVERT(rwlock, orig, vg_orig); 3014 CONVERT(rwlockattr, attr, vg_attr); 3015 3016 if (0) printf ("pthread_rwlock_init\n"); 3017 /* Install the lock preference; the remapper needs to know it. */ 3018 if (vg_attr) 3019 vg_orig->__vg_rw_kind = vg_attr->__vg_lockkind; 3020 else 3021 vg_orig->__vg_rw_kind = PTHREAD_RWLOCK_DEFAULT_NP; 3022 /* Allocate the shadow */ 3023 rwl = rw_new (orig); 3024 return 0; 3025 } ------------------ -- DasI > Tom > > -- > Tom Hughes (th...@cy...) > Software Engineer, Cyberscience Corporation > http://www.cyberscience.com/ > |