[m-rev.] for review: support STM in low level grades
Ben Mellor
bmellor at csse.unimelb.edu.au
Mon May 4 11:48:12 AEST 2009
> > +#if !defined(MR_HIGHLEVEL_CODE)
> > +/*
> > +** In the low level C grades, the "condition variable" created when an STM
> > +** transaction blocks is actually a pointer to the transaction log.
> > "Signalling" +** it consists of going through the STM variables listed in
> > the log and removing +** the waiters attached to them for the context
> > listed in the log. After this, +** the context can be safely rescheduled.
> > +*/
>
> Are these over-long lines?
I thought no, as they were 80 characters, but I see the coding standard
specifies 79. I've fixed them.
> > +void
> > +MR_STM_condvar_signal(MR_STM_ConditionVar *cvar)
> > +{
> > + /*
> > + ** Calling MR_STM_unwait here should be safe, as this signalling is
> > called
> > + ** in response to a commit, while the committing thread holds the
> > global
> > + ** STM lock. Note that a MR_STM_ConditionVar IS a MR_STM_TransLog if
> > + ** MR_HIGHLEVEL_CODE is not defined, which is why cvar is passed twice.
> > + */
> > + MR_STM_unwait(cvar, cvar);
> > +
> > +#if defined(MR_STM_DEBUG)
> > + fprintf(stderr, "STM RESCHEDULING: log <0x%.8lx>\n",
> > (MR_Word)cvar); +#endif
> >
> > + MR_schedule_context(MR_STM_context_from_condvar(cvar));
> > }
> > +
> > +#endif
>
> Please add a warning to the prototype for MR_STM_condvar_signal to inform
> anyone calling this function that they must first have the global STM lock as
> mentioned in your comment.
/*
** NOTE: The global STM lock (MR_STM_lock) must be held when calling this
** function, as it manipulates the STM variable waiter lists.
*/
> > + extern void MR_STM_condvar_signal(MR_STM_ConditionVar *cvar);
> > +
> > + #define MR_STM_context_from_condvar(x) (x->MR_STM_tl_thread)
> >
> > #endif /* !MR_HIGHLEVEL_CODE */
>
> Why is MR_STM_condvar_signal defined as 'extern'?
Absent-mindedness. I've removed the extern.
Cheers
-- Ben
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list