44 |
|
|
45 |
static struct stream out[STREAM_COUNT]; |
static struct stream out[STREAM_COUNT]; |
46 |
static int cur_stream_id = 0; |
static int cur_stream_id = 0; |
47 |
static pthread_mutex_t *tcp_sendcontrol_mutex = NULL; |
static pthread_mutex_t **scard_mutex = NULL; |
|
static pthread_mutex_t *sec_channels_mutex = NULL; |
|
48 |
|
|
49 |
static uint32 curDevice = 0, curId = 0, curBytesOut = 0; |
static uint32 curDevice = 0, curId = 0, curBytesOut = 0; |
50 |
static PSCNameMapRec nameMapList = NULL; |
static PSCNameMapRec nameMapList = NULL; |
2619 |
#endif /* MAKE_PROTO */ |
#endif /* MAKE_PROTO */ |
2620 |
|
|
2621 |
void |
void |
2622 |
scard_tcp_lock(void) |
scard_lock(int lock) |
2623 |
{ |
{ |
2624 |
if (!tcp_sendcontrol_mutex) |
if (!scard_mutex) |
2625 |
{ |
{ |
2626 |
tcp_sendcontrol_mutex = (pthread_mutex_t *) xmalloc(sizeof(pthread_mutex_t)); |
scard_mutex = |
2627 |
pthread_mutex_init(tcp_sendcontrol_mutex, NULL); |
(pthread_mutex_t **) xmalloc(sizeof(pthread_mutex_t *) * SCARD_LOCK_LAST); |
2628 |
} |
} |
2629 |
|
|
2630 |
pthread_mutex_lock(tcp_sendcontrol_mutex); |
if (!scard_mutex[lock]) |
|
} |
|
|
|
|
|
void |
|
|
scard_tcp_unlock(void) |
|
|
{ |
|
|
pthread_mutex_unlock(tcp_sendcontrol_mutex); |
|
|
} |
|
|
|
|
|
void |
|
|
scard_sec_lock(void) |
|
|
{ |
|
|
if (!sec_channels_mutex) |
|
2631 |
{ |
{ |
2632 |
sec_channels_mutex = (pthread_mutex_t *) xmalloc(sizeof(pthread_mutex_t)); |
scard_mutex[lock] = (pthread_mutex_t *) xmalloc(sizeof(pthread_mutex_t)); |
2633 |
pthread_mutex_init(sec_channels_mutex, NULL); |
pthread_mutex_init(scard_mutex[lock], NULL); |
2634 |
} |
} |
2635 |
|
|
2636 |
pthread_mutex_lock(sec_channels_mutex); |
pthread_mutex_lock(scard_mutex[lock]); |
2637 |
} |
} |
2638 |
|
|
2639 |
void |
void |
2640 |
scard_sec_unlock(void) |
scard_unlock(int lock) |
2641 |
{ |
{ |
2642 |
pthread_mutex_unlock(sec_channels_mutex); |
pthread_mutex_unlock(scard_mutex[lock]); |
2643 |
} |
} |
2644 |
|
|
2645 |
STREAM |
STREAM |