[bt-devel] Bookshelf manager bugs

Joachim Ansorg nospam+bt-devel at joachim-ansorg.de
Sat Jan 10 04:59:40 MST 2009


Hi,
I just noticed this email.
I had a short look at the code but didn't look too closely. So I might be 
wrong :)

> > Technical notes:
> > I can't say for sure that the problem is not in the code written by me,
> > but I think it's in the Sword library or possibly in the ftp library
> > used by the Sword library. Most probably it's the Sword library. It
> > means that if we want to have concurrent installing we have to replace
> > the Sword install manager. It would be much work and means duplicating
> > the code, copying it from the Sword library to our own codebase. The
> > case would be easier if the problem is in the ftp library because we
> > could just use the QFtp class instead and in return would get finer
> > control over the connection and failure situations.

> This didn't happen with my older machine but happens quite often with
> the new dualcore.

I think we can't assume that Sword's SWMgr is reentrant or thread-safe.
Thus it's better to synchronize the access to Sword with a Mutex 
(http://doc.trolltech.com/4.4/qmutex.html).
Even though you create a separate SWMgr for each thread it doesn't mean it's 
thread safe. SWMgr could access shared data for example.

With a single core cpu not-thread-safe code doesn't show the symptoms quickly. 
With two ore more cores the threads are likely to be run concurrently and this 
shows the bugs more quickly.

Unless you are sure that SWMgr is thread safe I'd use a QMutex. It needs to be 
shared between the threads to make sure only one thread at a time works with 
Sword at the same time.
I didn't look into the code if this doesn't break the concurrent installs, 
though.

Joachim



More information about the bt-devel mailing list