[sword-devel] Creating a "SWORD-over-network" protocol for remote SWORD repo access?
Troy A. Griffitts
scribe at crosswire.org
Mon Aug 5 18:47:34 EDT 2024
If you follow advice to have 1 InstallMgr instance per thread, it is perfectly thread safe. We don't try to allow multiple threads to begin installations of multiple modules using the same instance of an InstallMgr. Just new an InstallMgr for each parallel module installation you wish to start. If you are worried about your UI thread calling terminate on an InstallMgr in a worker thread, every SWORD frontend since time began does this. If you can imagine a scenario you could create which might in a million times fail (e.g. if (transport) [another thread finishes and destroys transport] transport->terminate()) and you actually think this is a practical concern worth adding to your UI, then take the advice in the comment and call terminate from your status update callback, which is called from the transport object itself assuring it will be true.
On August 5, 2024 09:33:20 GMT+02:00, Jaak Ristioja <jaak at ristioja.ee> wrote:
>On 04.08.24 22:49, Troy A. Griffitts wrote:
>> On 8/3/24 12:21 PM, Jaak Ristioja wrote:
>>> Libsword does not well lend itself to certain tasks, and some are impossible. For example, there is still no reliable way for users to abort module installation/download in a thread-safe manner. Working around such libsword shortcomings without changing libsword is not worth the effort.
>>
>> Hi Jaak,
>>
>> libsword provides for a thread to request termination of a transfer with InstallMgr::terminate():
>>
>> https://github.com/bibletime/crosswire-sword-mirror/blob/trunk/include/installmgr.h#L297-L301
>
>Hi Troy,
>
>Yes, but it is still not thread-safe:
>
>
>https://github.com/bibletime/crosswire-sword-mirror/blob/trunk/src/mgr/installmgr.cpp#L276
>
>https://github.com/bibletime/crosswire-sword-mirror/blob/trunk/include/remotetrans.h#L100
>
>https://github.com/bibletime/crosswire-sword-mirror/blob/trunk/include/remotetrans.h#L62
>
>https://github.com/bibletime/crosswire-sword-mirror/blob/trunk/src/mgr/remotetrans.cpp#L210
>
>
>Best regards,
>Jaak Ristioja
>
>_______________________________________________
>sword-devel mailing list: sword-devel at crosswire.org
>http://crosswire.org/mailman/listinfo/sword-devel
>Instructions to unsubscribe/change your settings at above page
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20240806/bd29edf6/attachment.htm>
More information about the sword-devel
mailing list