DMD 1.022 and 2.005 releases - what's wrong with threading?

Sean Kelly sean at f4.ca
Sun Oct 7 15:42:50 PDT 2007


Walter Bright wrote:
> David Brown wrote:
>> On Sun, Oct 07, 2007 at 10:57:31AM -0700, Walter Bright wrote:
>>> David Brown wrote:
>>>>   - 'pause/resume' is not a useful thread primitive.  As we've seen by
>>>>   sample code, just doing simple things is dreadfully difficult, and
>>>>   very easy to get wrong, having deadlocks, starvation, and other
>>>>   issues.
>>>
>>> The main reason for the existence of pause/resume is so the garbage 
>>> collector can pause all the threads, do a gc sweep, then resume them.
>>
>> I don't think they should go away :-)  I just think there needs to be
>> something else to use for synchronization.  Just because it is 
>> possible to
>> synchronize with pause/resume, doesn't mean one should.
> 
> It never occurred to me that someone would use pause/resume for syncing. 
> I thought the concepts were orthogonal.

For what it's worth, Java has pause/resume as deprecated members of its 
Thread class.  I suspect they originally included them for garbage 
collection as well, and deprecated them when people started using them 
for synchronization (they're a fantastic way to deadlock an app).  Doug 
Lea's containers and such use them, for example, because Java does not 
offer standalone mutexes, semaphores, etc.


Sean



More information about the Digitalmars-d mailing list