druntime thread_needLock()

Fawzi Mohamed fmohamed at mac.com
Sat Dec 6 23:55:22 PST 2008


On 2008-12-07 06:34:20 +0100, Robert Fraser <fraserofthenight at gmail.com> said:

> Leandro Lucarella wrote:
>> Christopher Wright, el  6 de diciembre a las 09:06 me escribiste:
>>> Fawzi Mohamed wrote:
>>>> So yes one could probably switch back to the old Phobos style.
>>>> I would guess that it is not really a common situation for a program to 
>>>> become single threaded again, though...
>>>> Fawzi
>>> At work, we have a single-threaded application -- everything happens on 
>>> the GUI thread. There are some operations that take a long time, 
>>> though. For those, we throw up a spinny dialog box. But if these 
>>> operations happened on the GUI thread, the spinny dialog box would not 
>>> spin. So we do the expensive operations on a background thread.
>>> 
>>> So, our application becomes multithreaded on rare occasions and becomes 
>>> single-threaded again after.
>>> 
>>> Not sure how common this is.
>> 
>> I think this is pretty common in GUI applications, but I don't think GUI
>> applications usually are performance critical, right?
>> 
> 
> Maya? Combustion? Final Cut Pro? Photoshop? Visual Studio (it shouldn't 
> be, but it can get damn slow on occasion)?
> 
> Heck, most GUI programs seem like they "could be faster". Opening 
> Outlook takes 30 seconds. Firefox takes 5-10 seconds to start. Even 
> Windows Explorer feels sluggish (to its credit, much less so than Gnome 
> or KDE). I'm not sure if this translates to "performance-critical", but 
> it's certainly something to think about.

all example that you did are heavily multithreaded as far as I know, 
(VisualStudio I do not know).
An the standard way to make a GUI more responsive is th make it 
multithreaded (offloading computational intensive tasks.
The GUI is driven by a single thread, but the application itself is 
multithreaded.
If you have a single threaded application that it too slow in the 
single threaded parts, probably to speed it up you would want to make 
it multithreaded.
So is the speedup of single threaded parts worht making the runtime 
depend on memory barriers, that are not implemented for each platform?
I don't think so.

Fawzi




More information about the Digitalmars-d mailing list