Subject: Re: build aborts in regress/lib/libpthread/sem
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Marcus Comstedt <marcus@mc.pp.se>
List: port-dreamcast
Date: 02/23/2003 01:31:20
Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> writes:
> Yeah, I think Jason's idea is a good compromise.
> But how do you think about adding G2LOCK_DECL macro
> to declare the temp variable instead of pass it via an arg?
Yes, using a macro to declare the needed variable(s) would be a good
idea since it means only one place to edit if for example the type
changes.
> > But
> > I'm still a bit puzzled why you'd want the critical section to span
> > the beginning and end of the loop, but not the middle. What does the
> > actual code look like?
>
> Well, my example is not so good (since I'm not a good programmer :-)
> More particular case I know is:
>
> {
> G2LOCK();
> :
> if (xxx) {
> G2_UNLOCK();
> return;
> }
> :
> G2_UNLOCK;
> }
But which bus_space functions have conditional returns? Is this
really an issue?
> I this case, maybe the portmaster's mind has priority.. :-)
I'm fine with the DECL+LOCK+UNLOCK proposal too. It's one more macro
call to add to each function, but what it expands to can easily be
changed in one place, and there is no risk of forgetting to call the
macro since you'd get a compilation error for missing variable
declarations. So maintenance-wise it's good enough.
// Marcus