From: Julian S. <js...@ac...> - 2002-10-22 13:24:14
|
Ok, it was just a sanity check. I'm assuming you've got this all figured out and will clean up and/or nuke get_current_tid_1_if_root as you see fit. J On Tuesday 22 October 2002 8:35 am, Jeremy Fitzhardinge wrote: > On Mon, 2002-10-21 at 21:45, Julian Seward wrote: > Nick: I spotted the infamous (?) VG_(get_current_tid_1_if_root) > and specifically this: > > if (0 == vg_tid_currently_in_baseBlock) > return 1; /* root thread */ > > What's the meaning of the 0 here? Where is it set? AFAICS the only > valid values of vg_tid_currently_in_baseBlock are either 1 .. > VG_N_THREADS or VG_INVALID_THREADID, so I guess I'm missing something here? > > No, I don't think so. I don't think that function means anything at > all. I was very close to removing it altogether. > > I don't feel like I'm seeing a consistent story I'm happy with re > vg_tid_currently_in_baseBlock -- can you two clarify? > > I put the stronger assert into save_thread_state() because I couldn't > see any good reason why the tid argument should ever mismatch the value > of vg_tid_currently_in_baseBlock. The assertion failed on the first > thread create, but I think my fix makes sense. Thread creation copies > the parent thread's context into the child via the baseBlock. In a > sense the ownership of the baseBlock changes during the copy, which is > what the assignment to vg_tid_currently_in_baseBlock indicates: > > VG_(load_thread_state)(parent_tid); /* load parent thread state into > baseBlock */ + vg_tid_currently_in_baseBlock = tid; /* give ownership of > baseBlock to child */ VG_(save_thread_state)(tid); /* save new state into > new thread */ > > > It seems like, with that change, it will be impossible to > know from the value of vg_tid_currently_in_baseBlock whether or > not baseBlock is "full". > > No, because save_thread_state() assigns vg_tid_currently_in_baseBlock > withVG_INVALID_THREADID, so you know the baseBlock contains nothing > afterwards. It gets reassigned with a valid tid on load_thread_state(). > > J |