File: lock_platform.c

package info (click to toggle)
xmlrpc-c 1.60.05-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,132 kB
  • sloc: ansic: 55,332; cpp: 13,541; sh: 3,321; makefile: 2,556; perl: 593; xml: 134
file content (48 lines) | stat: -rw-r--r-- 1,492 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*=============================================================================
                              lock_platform
===============================================================================

  This module provides locking services appropriate for the platform for
  which Xmlrpc-c is being built.  I.e. services chosen by the build
  configuration.

============================================================================*/

#include "xmlrpc_config.h"

#include "xmlrpc-c/lock_platform.h"

#if HAVE_PTHREAD
#include "xmlrpc-c/lock_pthread.h"
#endif

#if HAVE_WINDOWS_THREAD
#include "xmlrpc-c/lock_windows.h"
#endif

struct lock *
xmlrpc_lock_create(void) {

#if HAVE_PTHREAD
    return xmlrpc_lock_create_pthread();
#elif HAVE_WINDOWS_THREAD
    return xmlrpc_lock_create_windows();
#else
  #error "You don't have any thread facility.  (According to "
  #error "HAVE_PTHREAD and HAVE_WINDOWS_THREAD macros defined in "
  #error "xmlrpc_config.h)"

  /* One might consider using xmlrpc_lock_create_none() here, but that would
     be dangerous.  If the system really does have threads that share memory,
     and there's just some configuration error here (which is the most likely
     case), we would silently build a broken library, which breakage would be
     difficult for the user to detect and then diagnose.

     If we encounter some actual need for lock_none in the future, we'll
     revisit the issue of when the build system should select it
  */
#endif

}