[bt-devel] thread problems

Joachim Ansorg bt-devel@crosswire.org
Sun, 14 Jan 2001 17:35:17 +0100


Hi!

> When I did the threading in BT I had some very weird problems where I could
> not figure out the reason. But the problem may have been that I have very
> small knowledge of threading, which may be the same for you.

Yes :)

> Concerning BT my proposal would be that we get some good information about
> it and put it into the docs; and we should use QT THREADS. That might save
> us a lot of work and is probably more easy than using pure pthreads.

But I don't know if it's possible to use QThreads with pthreads (maybe in 
Sword).
But I'll give it a try.
Another problem is that we shouldn't make the backend depend on Qt, but if we 
use QT threads this dependency is there.

PS: I tested it, it doesn't work. That's why because we use libqt-mt and  KDE 
2 uses libqt, obviously using the same library in two different versions at 
one time crashes the program.
Sorry.

> For sword I don't know what should be done. I once asled on sword-devel,
> but nobody knew wether sword really _is_ thread safe. How can you find out
> if a program is thread safe, and how can you make it thread safe?

I don't know how to find it out, and my knowledge of threads is too bad to 
make Sword thread-safe.
If we make sure no variables are read and written at the same time and if we 
make sure no files are read at the same time it's thread safe.

IMHO Sword is _not_ thread safe. To explain this here's a small experiment:

Oen the a presenter and the searchdialog for a Bible module without index and 
search for God.
While it's searching change the key in the presenter and you'll get a wrong 
search result.

> BTW, what is reentrant?

Something like thread-safe, don't know exactly.

> Do such problems (BBE) also occur in the windows version?
>
> Martin

-- Joachim
BibleTime - www.bibletime.de - info@bibletime.de
BibleTime is an easy to use Bible study tool for KDE / Linux.