27#ifndef BTIF_SOCK_UTIL_H
28#define BTIF_SOCK_UTIL_H
31#include <cutils/log.h>
37static inline void init_slot_lock( pthread_mutex_t* mutex)
39 pthread_mutexattr_t attr;
40 pthread_mutexattr_init(&attr);
41 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
42 pthread_mutex_init(mutex, &attr);
45static inline void lock_slot(pthread_mutex_t* mutex)
48 pthread_mutex_lock(mutex);
49 else ALOGE(
"mutex: %p is not initialized", mutex);
52static inline void unlock_slot(pthread_mutex_t* mutex)
55 pthread_mutex_unlock(mutex);
56 else ALOGE(
"mutex: %p is not initialized", mutex);
59void dump_bin(
const char* title,
const char* data,
int size);
61int sock_send_fd(
int sock_fd,
const uint8_t* buffer,
int len,
int send_fd);
62int sock_send_all(
int sock_fd,
const uint8_t* buf,
int len);
63int sock_recv_all(
int sock_fd, uint8_t* buf,
int len);