Merge pull request #4911 from mysterywolf/rt_delayed_work_init
[workqueue] remove rt_delayed_work_init()
This commit is contained in:
commit
0880b43498
|
@ -5,6 +5,7 @@
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
* 2021-08-01 Meco Man remove rt_delayed_work_init() and rt_delayed_work structure
|
||||||
*/
|
*/
|
||||||
#ifndef WORKQUEUE_H__
|
#ifndef WORKQUEUE_H__
|
||||||
#define WORKQUEUE_H__
|
#define WORKQUEUE_H__
|
||||||
|
@ -48,11 +49,6 @@ struct rt_work
|
||||||
struct rt_workqueue *workqueue;
|
struct rt_workqueue *workqueue;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rt_delayed_work
|
|
||||||
{
|
|
||||||
struct rt_work work;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
#ifdef RT_USING_HEAP
|
||||||
/**
|
/**
|
||||||
* WorkQueue for DeviceDriver
|
* WorkQueue for DeviceDriver
|
||||||
|
@ -82,9 +78,6 @@ rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_wo
|
||||||
work->type = 0;
|
work->type = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt_delayed_work_init(struct rt_delayed_work *work, void (*work_func)(struct rt_work *work,
|
|
||||||
void *work_data), void *work_data);
|
|
||||||
|
|
||||||
#endif /* RT_USING_HEAP */
|
#endif /* RT_USING_HEAP */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2017-02-27 bernard fix the re-work issue.
|
* 2017-02-27 Bernard fix the re-work issue.
|
||||||
|
* 2021-08-01 Meco Man remove rt_delayed_work_init()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
|
@ -339,12 +340,6 @@ rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue)
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt_delayed_work_init(struct rt_delayed_work *work, void (*work_func)(struct rt_work *work,
|
|
||||||
void *work_data), void *work_data)
|
|
||||||
{
|
|
||||||
rt_work_init(&work->work, work_func, work_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RT_USING_SYSTEM_WORKQUEUE
|
#ifdef RT_USING_SYSTEM_WORKQUEUE
|
||||||
static struct rt_workqueue *sys_workq;
|
static struct rt_workqueue *sys_workq;
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,6 @@ static void check_netdev_internet_up_work(struct rt_work *work, void *work_data)
|
||||||
struct netdev *netdev = (struct netdev *)work_data;
|
struct netdev *netdev = (struct netdev *)work_data;
|
||||||
socklen_t addr_len = sizeof(struct sockaddr_in);
|
socklen_t addr_len = sizeof(struct sockaddr_in);
|
||||||
char send_data[SAL_INTERNET_BUFF_LEN], recv_data = 0;
|
char send_data[SAL_INTERNET_BUFF_LEN], recv_data = 0;
|
||||||
struct rt_delayed_work *delay_work = (struct rt_delayed_work *)work;
|
|
||||||
|
|
||||||
const char month[][SAL_INTERNET_MONTH_LEN] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
const char month[][SAL_INTERNET_MONTH_LEN] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||||
char date[SAL_INTERNET_DATE_LEN];
|
char date[SAL_INTERNET_DATE_LEN];
|
||||||
|
@ -176,7 +175,7 @@ static void check_netdev_internet_up_work(struct rt_work *work, void *work_data)
|
||||||
|
|
||||||
if (work)
|
if (work)
|
||||||
{
|
{
|
||||||
rt_free(delay_work);
|
rt_free(work);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get network interface socket operations */
|
/* get network interface socket operations */
|
||||||
|
@ -287,18 +286,18 @@ int sal_check_netdev_internet_up(struct netdev *netdev)
|
||||||
|
|
||||||
#ifdef SAL_INTERNET_CHECK
|
#ifdef SAL_INTERNET_CHECK
|
||||||
/* workqueue for network connect */
|
/* workqueue for network connect */
|
||||||
struct rt_delayed_work *net_work = RT_NULL;
|
struct rt_work *net_work = RT_NULL;
|
||||||
|
|
||||||
|
|
||||||
net_work = (struct rt_delayed_work *)rt_calloc(1, sizeof(struct rt_delayed_work));
|
net_work = (struct rt_work *)rt_calloc(1, sizeof(struct rt_work));
|
||||||
if (net_work == RT_NULL)
|
if (net_work == RT_NULL)
|
||||||
{
|
{
|
||||||
LOG_W("No memory for network interface device(%s) delay work.", netdev->name);
|
LOG_W("No memory for network interface device(%s) delay work.", netdev->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rt_delayed_work_init(net_work, check_netdev_internet_up_work, (void *)netdev);
|
rt_work_init(net_work, check_netdev_internet_up_work, (void *)netdev);
|
||||||
rt_work_submit(&(net_work->work), RT_TICK_PER_SECOND);
|
rt_work_submit(net_work, RT_TICK_PER_SECOND);
|
||||||
#endif /* SAL_INTERNET_CHECK */
|
#endif /* SAL_INTERNET_CHECK */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -619,7 +618,7 @@ int sal_accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
LOG_E("New socket registered failed, return error %d.", retval);
|
LOG_E("New socket registered failed, return error %d.", retval);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* new socket create by accept should have the same netdev with server*/
|
/* new socket create by accept should have the same netdev with server*/
|
||||||
new_sock->netdev = sock->netdev;
|
new_sock->netdev = sock->netdev;
|
||||||
/* socket structure user_data used to store the acquired new socket */
|
/* socket structure user_data used to store the acquired new socket */
|
||||||
|
@ -1176,4 +1175,3 @@ void sal_freeaddrinfo(struct addrinfo *ai)
|
||||||
pf->netdb_ops->freeaddrinfo(ai);
|
pf->netdb_ops->freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue