summaryrefslogtreecommitdiffstats
path: root/src/threads.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-09-06 16:52:14 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-09-06 16:52:14 +0200
commit49f57a8d0dcf990169e2f591a937672f74ffa4a9 (patch)
treee8f872af3dd4f0c7d02ef47e214f016747396c23 /src/threads.c
parentfbe102bada583f308450c27e256053b51643a532 (diff)
downloadlibssh-49f57a8d0dcf990169e2f591a937672f74ffa4a9.tar.gz
libssh-49f57a8d0dcf990169e2f591a937672f74ffa4a9.tar.xz
libssh-49f57a8d0dcf990169e2f591a937672f74ffa4a9.zip
Implemented the noop and native pointers
Diffstat (limited to 'src/threads.c')
-rw-r--r--src/threads.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/threads.c b/src/threads.c
index 51a4ccf..022ca2c 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -30,6 +30,25 @@
#include "libssh/priv.h"
#include "libssh/threads.h"
+static int threads_noop (void **lock){
+ (void)lock;
+ return 0;
+}
+
+static unsigned long threads_id_noop (void){
+ return 1;
+}
+
+struct ssh_threads_callbacks_struct ssh_threads_noop =
+{
+ .type=ssh_threads_type_noop,
+ .mutex_init=threads_noop,
+ .mutex_destroy=threads_noop,
+ .mutex_lock=threads_noop,
+ .mutex_unlock=threads_noop,
+ .thread_id=threads_id_noop
+};
+
static struct ssh_threads_callbacks_struct *user_callbacks;
#ifdef HAVE_LIBGCRYPT
@@ -107,7 +126,7 @@ int ssh_threads_init(void){
* already the case
*/
if(user_callbacks == NULL){
- return SSH_ERROR; // Can't do anything to initialize threading
+ user_callbacks=&ssh_threads_noop;
}
/* Then initialize the crypto libraries threading callbacks */