December 03, 2005 Re: On condvars | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | >I think it would be quite useful so long as it's implemented correctly. Reminds me of the time where this guy wanted to start a development project and stated the goals to us, including such oddities as "bug free software" and "fast code"... ;) Well, the Posix implementation shouldn't be a problem, really. The Windows stuff is - not intuitive. The worst about the SignalAndWait() function in Windows is that I can't use a CriticalSection there. Now is the time to ask if it's worth replacing CriticalSection for Mutex in the synchronized() blocks... Either way the implementation on Windows will be less elegant. > And the design seems pretty clean and straightforward. I'll certainly >want condvars once I start doing application coding in D. > Yeah, I think we will need them to be able to lure Java and C# people to D. (However, the syntax in C# wasn't very attractive, so I wonder if anyone uses it.) |
December 03, 2005 Re: On condvars | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tommie Gannert | Tommie Gannert wrote: >> I think it would be quite useful so long as it's implemented correctly. > > Reminds me of the time where this guy wanted to start a development project and > stated the goals to us, including such oddities as "bug free software" and "fast > code"... ;) > > Well, the Posix implementation shouldn't be a problem, really. The Windows stuff > is - not intuitive. The worst about the SignalAndWait() function in Windows is > that I can't use a CriticalSection there. Now is the time to ask if it's worth > replacing CriticalSection for Mutex in the synchronized() blocks... Either way > the implementation on Windows will be less elegant. hehe, I said that only because getting it right on Windows is so difficult :) The Boost implementation uses something like three semaphores and I've heard comments that it still has issues (though this was a while ago). >> And the design seems pretty clean and straightforward. I'll certainly want condvars once I start doing application coding in D. > > Yeah, I think we will need them to be able to lure Java and C# people to D. > (However, the syntax in C# wasn't very attractive, so I wonder if anyone uses > it.) Windows people tend not to be particularly familiar with condvars, but they're about the only way I know of to do multiple producer/consumer correctly. All the standard Windows methods I know of tend to have subtle races and spurious wakeup problems. This is one area that Java has become quite nice, thanks, I suppose, to Doug Lea. Sean |
January 13, 2006 Re: On condvars | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly wrote: > Tommie Gannert wrote: >>> I think it would be quite useful so long as it's implemented correctly. >> >> Reminds me of the time where this guy wanted to start a development project and >> stated the goals to us, including such oddities as "bug free software" and "fast >> code"... ;) >> >> Well, the Posix implementation shouldn't be a problem, really. The Windows stuff >> is - not intuitive. The worst about the SignalAndWait() function in Windows is >> that I can't use a CriticalSection there. Now is the time to ask if it's worth >> replacing CriticalSection for Mutex in the synchronized() blocks... Either way >> the implementation on Windows will be less elegant. > > hehe, I said that only because getting it right on Windows is so difficult :) The Boost implementation uses something like three semaphores and I've heard comments that it still has issues (though this was a while ago). This topic resurfaced again recently on c.p.t so I did a bit of looking. There are three pseudocode implementations for condvars in this (somewhat old) thread: http://groups.google.com/group/comp.programming.threads/browse_frm/thread/6191877e72ccb3fe/846010a82d6c51b0#846010a82d6c51b0 Also, this project likely has a correct pthread implementation for Win32, though it uses the LGPL license: http://sourceware.org/pthreads-win32/ It's worth noting that this project uses an algorithm described in the aforementioned usenet thread (Algorithm 8a). If I suddenly find some time to play with this I'll translate one of the algothms (8a or 8c) to D code--it would be great to have cross-platform condvar support in D. Sean |
Copyright © 1999-2021 by the D Language Foundation