00001
00027 #ifndef POLARSSL_THREADING_H
00028 #define POLARSSL_THREADING_H
00029
00030 #include "config.h"
00031
00032 #include <stdlib.h>
00033
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
00038 #define POLARSSL_ERR_THREADING_FEATURE_UNAVAILABLE -0x001A
00039 #define POLARSSL_ERR_THREADING_BAD_INPUT_DATA -0x001C
00040 #define POLARSSL_ERR_THREADING_MUTEX_ERROR -0x001E
00042 #if defined(POLARSSL_THREADING_DUMMY)
00043 typedef void threading_mutex_t;
00044 #endif
00045
00046 #if defined(POLARSSL_THREADING_PTHREAD)
00047 #include <pthread.h>
00048 typedef pthread_mutex_t threading_mutex_t;
00049 #endif
00050
00051 #if defined(POLARSSL_THREADING_ALT)
00052
00053 #include "threading_alt.h"
00054
00066 int threading_set_alt( int (*mutex_init)( threading_mutex_t * ),
00067 int (*mutex_free)( threading_mutex_t * ),
00068 int (*mutex_lock)( threading_mutex_t * ),
00069 int (*mutex_unlock)( threading_mutex_t * ) );
00070 #endif
00071
00072
00073
00074
00075
00076
00077 extern int (*polarssl_mutex_init)( threading_mutex_t *mutex );
00078 extern int (*polarssl_mutex_free)( threading_mutex_t *mutex );
00079 extern int (*polarssl_mutex_lock)( threading_mutex_t *mutex );
00080 extern int (*polarssl_mutex_unlock)( threading_mutex_t *mutex );
00081
00082 #ifdef __cplusplus
00083 }
00084 #endif
00085
00086 #endif