[sword-devel] thread-safety in libsword?

Greg Hellings greg.hellings at gmail.com
Mon Jan 11 08:04:22 MST 2016


The library has no guarantees of multi-threaded safety, so you'll need
to handle locking outside of the library.

Out of curiosity: what types of simultaneous/multi-threaded calls are
you performing? Some things can be parallelized by instantiating
multiple instances of SWMgr (e.g. this is how BibleTime used to
perform parallel downloads during module install).

--Greg

On Mon, Jan 11, 2016 at 6:52 AM, Teus Benschop <teusjannette at gmail.com> wrote:
> Hi,
>
> When accessing libsword simultaneously from multiple threads, it often
> crashes. When surrounding the calls to the library with a mutex.lock and a
> mutex.unlock at the end, there's no crashes when accessing it in the same
> situation. I am seeing this on Linux and on the Mac. Should I do something
> in the library, or make a special call, to make it thread-safe? Or is
> surrounding the library calls with a mutex the recommended way to handle
> this?
>
> Teus.
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page



More information about the sword-devel mailing list