View Issue Details

IDProjectCategoryView StatusLast Update
00002291003.1(2008)/Issue 7System Interfacespublic2013-04-16 13:06
Reporterlacos Assigned Toajosey  
PrioritynormalSeverityCommentTypeError
Status ClosedResolutionAccepted 
NameLaszlo Ersek
Organization
User Referencelacos.susv4.pthread_cleanup_pop.examples
Sectionpthread_cleanup_pop() EXAMPLES
Page Number1575-1576
Line Number50593,50608,50617,50619,50620,50644
Interp Status---
Final Accepted Text
Summary0000229: rwlock example: Writers-priority broken. Typographical errors. Canceled writer broadcasts wrong condvar. Laconic comment.
DescriptionThe "description" and the "desired action" sections are a compilation of the following three messages, numbered in chronological order:

[1]
From: "Ersek, Laszlo"
Date: Thu, 25 Mar 2010 21:08:40 +0100 (CET)
Message-ID: <Pine.LNX.4.64.1003252028120.23995@login01.caesar.elte.hu>
austin-group-l item 13544


[2]
From: Vladimir S. Sheviakov
Date: Fri, 26 Mar 2010 12:17:36 +0300
Message-ID: <019401caccc5$2cee9fa0$2a0510b0@excalibur>
austin-group-l item 13547


[3]
From: Geoff Clare
Date: Fri, 26 Mar 2010 10:26:55 +0000
Message-ID: <20100326102655.GA23071@squonk.masqnet>
austin-group-l item 13548



The
&&
operator used in the controlling expression of the
while
statement on line 50593 breaks the "writers-priority" property of the read-write lock, in function
lock_for_read()
. [1] [2]

release_read_lock()
passes a pointer of incompatible type to
pthread_mutex_unlock()
on line 50608. [2]

The comment in
waiting_writer_cleanup()
, line 50617, doesn't explain the situation in sufficient detail when the broadcast is sent. On line 50619, the wrong condition variable is broadcast. On line 50620, the closing brace is incorrectly indented. [3]

release_write_lock()
contains a syntax error on line 50644 (missing semicolon after expression statement). [2]
Desired Action(Correct indentation is not reflected in the suggested, quoted changes.)

Line 50593: [1] [2] change

while ((l->lock_count < 0) && (l->waiting_writers != 0))


to

while ((l->lock_count < 0) || (l->waiting_writers != 0))



Line 50608: [2] change

pthread_mutex_unlock(l);


to

pthread_mutex_unlock(&l->lock);



Line 50617: [3] replace the one line comment body

* This only happens if we have been canceled.


with

* This only happens if we have been canceled.  If the
* lock is not held by a writer, there may be readers who
* were blocked because waiting_writers was positive; they
* can now be unblocked.



Line 50619: [3] change

pthread_cond_broadcast(&l->wcond);


to

pthread_cond_broadcast(&l->rcond);



Line 50620: [3] increase the indentation of the closing brace from zero <space> characters to four <space> characters.


Line 50644: [2] replace

pthread_cond_broadcast(&l->rcond)


with

pthread_cond_broadcast(&l->rcond);
Tagstc1-2008

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2010-03-26 23:05 lacos New Issue
2010-03-26 23:05 lacos Status New => Under Review
2010-03-26 23:05 lacos Assigned To => ajosey
2010-03-26 23:05 lacos Name => Laszlo Ersek
2010-03-26 23:05 lacos User Reference => lacos.susv4.pthread_cleanup_pop.examples
2010-03-26 23:05 lacos Section => pthread_cleanup_pop() EXAMPLES
2010-03-26 23:05 lacos Page Number => 1575-1576
2010-03-26 23:05 lacos Line Number => 50593,50608,50617,50619,50620,50644
2010-04-15 15:35 geoffclare Interp Status => ---
2010-04-15 15:35 geoffclare Status Under Review => Resolved
2010-04-15 15:35 geoffclare Resolution Open => Accepted
2010-08-27 12:52 ajosey Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Resolved => Closed