net/local: extern local_generate_instance_id() interface
Change-Id: I14273d11b1fe4d6bdc15b14e32da609cc7883713 Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
a7c9f701ef
commit
9f3f4fb558
@ -664,6 +664,16 @@ int local_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds);
|
|||||||
|
|
||||||
int local_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds);
|
int local_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: local_generate_instance_id
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Generate instance ID for stream
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int32_t local_generate_instance_id(void);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -45,26 +45,6 @@
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: local_generate_instance_id
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static int32_t local_generate_instance_id(void)
|
|
||||||
{
|
|
||||||
static int32_t g_next_instance_id = 0;
|
|
||||||
int32_t id;
|
|
||||||
|
|
||||||
/* Called from local_connect with net_lock held. */
|
|
||||||
|
|
||||||
id = g_next_instance_id++;
|
|
||||||
if (g_next_instance_id < 0)
|
|
||||||
{
|
|
||||||
g_next_instance_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: _local_semtake() and _local_semgive()
|
* Name: _local_semtake() and _local_semgive()
|
||||||
*
|
*
|
||||||
@ -216,6 +196,30 @@ errout_with_fifos:
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: local_generate_instance_id
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Generate instance ID for stream
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int32_t local_generate_instance_id(void)
|
||||||
|
{
|
||||||
|
static int32_t g_next_instance_id = 0;
|
||||||
|
int32_t id;
|
||||||
|
|
||||||
|
/* Called from local_connect with net_lock held. */
|
||||||
|
|
||||||
|
id = g_next_instance_id++;
|
||||||
|
if (g_next_instance_id < 0)
|
||||||
|
{
|
||||||
|
g_next_instance_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: psock_local_connect
|
* Name: psock_local_connect
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user