[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: threads
From:       Stephan Kulow <coolo () kde ! org>
Date:       1999-12-03 15:14:31
[Download RAW message or body]

Jo Dillon wrote:
> 
> Roberto Alsina (ralsina@unl.edu.ar) spake thusly:
> > On Fri, 3 Dec 1999, Jo Dillon wrote:
> >
> > > Lubos Lunak (l.lunak@sh.cvut.cz) spake thusly:
> > > > >PS: Ask yourself why QString isn't thread-safe. If you don't know the answer,
> > > > >you know why we shouldn't use threads.
> > > >
> > > > QString _IS_ thread-safe with Pth.
> > >
> > >   How? Using a user-space thread library will not magically add mutexes
> > > around all the QString methods. It certainly won't make QList's
> > > built-in iterator (first()/next()/etc) threadsafe.
> >
> > Using userspace threads, you won't get switched away without doing it
> > yourself either explicitly by a yield() or implicitly by a pth_read() or
> > whatever.
> >
> > So, all of QString methods are effectively mutexed because simply no other
> > thread will execute any code while you are in Qt, so there can't be any
> > contention about who "owns" the QString, so no need to acquire a mutex for
> > it.
> >
> > Of course I may have misunderstood you completely :-)
> 
>   No, you didn't ;) Well, only that by 'userspace threads' I was
> thinking of /preemptive/ user-space threads (which are possible
> and do exist), not cooperative ones.
> 
What you mean are lightweight processes. These are even less portable
afaik :)

Greetings, Stephan

-- 
As long as Linux remains a religion of freeware fanatics,
Microsoft have nothing to worry about.  
                       By Michael Surkan, PC Week Online

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic