s3: fix detection and flags for using pthread
[ira/wip.git] / source3 / libsmb / libsmb_thread_posix.c
1 /* 
2    Unix SMB/Netbios implementation.
3    SMB client library implementation
4    Copyright (C) Derrell Lipman 2009
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 #include "includes.h"
22 #ifdef HAVE_PTHREAD_H
23 #include <pthread.h>
24 #endif
25 #include "libsmbclient.h"
26 #include "libsmb_internal.h"
27
28
29 /* Get rid of the malloc checker */
30 #ifdef malloc
31 #undef malloc
32 #endif
33
34 /*
35  * Define the functions which implement the pthread interface
36  */
37 SMB_THREADS_DEF_PTHREAD_IMPLEMENTATION(tf);
38
39
40 /**
41  * Initialize for threads using the Posix Threads (pthread)
42  * implementation. This is a built-in implementation, avoiding the need to
43  * implement the component functions of the thread interface. If this function
44  * is used, it is not necessary to call smbc_thread_impl().
45  *
46  * @return {void}
47  */
48 void
49 smbc_thread_posix(void)
50 {
51         smb_thread_set_functions(&tf);
52 }
53