Re: Re: problem compiling KDar with libdar CVS

Johnathan Burchill <[email protected]> Sat, 06 Nov 2004 15:48:15 -0700
Newsgroups gmane.comp.sysutils.backup.dar.libdar
Message-ID <[email protected]>
Hi Denis,

On Wednesday 03 November 2004 13:08, Denis Corbin wrote:
> Denis Corbin wrote:
> |[...]
> | I proposes the following API :
> |
> | ~    void cancel_thread(pthread_t tid);
> | ~    bool cancel_current(pthread_t & tid);
> | ~    void cancel_clear();
> |
> | where cancel_thread() is used to cancel the given thread. Which will
> | make libdar throw a Euser_abort exception, cleanly free memory and
> | release any mutex.
> |
> | cancel_current() return true and the tid of the thread that will be
> | canceled when execution will reach the next checkpoint, false if there
> | is not pending cancelation.
> |
> | cancel_clear() abort cancelation process if the thread has not already
> | terminated.
> |
> | Only one thread can be canceled at a time.
> |
> |
> |[...]
>
> Hello,
>
> This is implemented and tested. CVS is up to date. If you have no
> objections, The API is now frozen (version 3) for the release 2.2.0 that
> will come in december I hope. The points that remains to do before the
> pre-release phase are :
> - documentation (API, user guide, etc.)
> - password/key from file
> - password/key from keyboard out of command-line
> - some few other strong encryption algorithms
> - LZO compression
>
> the two password/key features do not have any impact on the API (these
> are command-line related feature). The LZO and the new cypher support
> only add some more values in the "enum compression" and "enum
> crypto_algo" enumeration types.
>
> The pre-release target date is the beginning of december. Until that
> time, it is still time to fix API problem you could meet, so please give
> your feedback before pre-release phase.

I've got KDar running on libdar API V3.0.0, CVS. Works great!
The thread cancelation works perfectly, my limited testing shows.
The response is very snappy, and the user does not have to wait or restart 
the program to stop an operation anymore. I think that you have a good 
implementation of thread cancelation. Quite elegant.

One point about libdar's "make install": the config.h header that gets put 
into <installdir>/include/dar/ does not contain "#define MUTEX_WORKS 1" 
when I configure libdar with pthreads, so I have to add it manually to get 
KDar to compile.

As an aside, here is a tip for people who want to implement thread 
cancellation in QT:

Note that to cancel a libdar operation, you need to pass the ID of the 
thread to cancel to libdar::cancel_thread(). You have to get this ID from 
the "run()" method of the QThread, not it's constructor or anywhere else. 
i.e. put "pthread_self()" inside run() and store it with a protected 
member variable. This is not well documented by Trolltech, and it had me 
puzzled for many hours today...

[...]

Cheers,
JB

-- 
Johnathan K. Burchill, Ph.D.
[email protected]
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBBjVSwrXMSOtiWrO4RAvPxAKCch6Q/hZ7YLALgECEStB2xB31ONwCcDc2e
07YSi7Qz1Uo0W9JHg2ZQlMQ=
=4OSs
-----END PGP SIGNATURE-----