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 <j...@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@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.
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page