On Tue, 31 Aug 2010, Michel Valin wrote:

1) Provide an APIs and let the caller set mutex hooks.

   Pros:
   - The library does not have to link a thread library.
   - No layering violation.

   Cons:
   - It is easy to forget to make this call when you are writing
     a multi-threaded program, which can lead to subtle errors.

This one can be alleviated by having the library issue a warning message at first initialization (lib_sh2_init) reminding the user that the thread-safe hook is not set.

Not really.

First, how would that warning be issued? We can't assume that the library can send any output anywhere that anyone will notice.

Secondly, the library doesn't know if it will be used threaded so it would have no warn on every init that doesn't use the mutex callbacks even if they wouldn't be needed!

--

 / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to