(j3.2006) LOCK/UNLOCK question
dick.hendrickson at att.net
dick.hendrickson
Wed Jun 17 14:51:45 EDT 2009
-------------- Original message from Bill Long <longb at cray.com>: --------------
> It is possible to have a clue-limited programmer who would put a lock in
> one function and an unlock for the same variable in a different
> function, and then write a statement that executes both functions.
>
Actually, that's probably already illegal. I think the no-side-effects-on-
the-same-statement rule in section 7 would also apply to lock variables.
> However, it is also possible (and more likely) for a programmer to write
> a function with both the lock and unlock, in the right order, and
> serving a useful purpose.
>
> I'd lean towards letting the second programmer do the useful thing at
> the expense of having to tell the first programmer that he has written a
> badly designed program.
>
But it's more than just telling him it's badly designed. You've got to
get the words right to define all of the illegal (not unwise) cases. I
think it's harder than just adding LOCK/UNLOCK to the paragraph
in question.
I don't think it's totally unreasonable to acquire a lock in one routine and
release it in another. I can even imagine using a lock variable that is never
unlocked as a "control construct" to set up an execute only once on whatever
image gets here first block of code.
Dick Hendrickson
> Cheers,
> Bill
>
>
>
>
>
> dick.hendrickson at att.net wrote:
> >
> >
> > Isn't one big difference that lock/unlock isn't a block construct.
> > If I understand
> > it right, there's no requirement that the lock and unlock statement
> > be in the
> > same procedure. [I don't even think you need an unlock statement.]
> > What would
> > prevent the optimizer from invoking the procedure with the unlock
> > first?
> >
> > Dick Hendrickson
> >
> >
> --
> Bill Long longb at cray.com
> Fortran Technical Support & voice: 651-605-9024
> Bioinformatics Software Development fax: 651-605-9142
> Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
>
>
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20090617/c3690dcf/attachment.html
More information about the J3
mailing list