Merge pull request #4911 from mysterywolf/rt_delayed_work_init

[workqueue] remove rt_delayed_work_init()
This commit is contained in:
Bernard Xiong 2021-08-09 08:52:19 +08:00 committed by GitHub
commit 0880b43498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 23 deletions

View File

@ -5,6 +5,7 @@
*
* Change Logs:
* Date Author Notes
* 2021-08-01 Meco Man remove rt_delayed_work_init() and rt_delayed_work structure
*/
#ifndef WORKQUEUE_H__
#define WORKQUEUE_H__
@ -48,11 +49,6 @@ struct rt_work
struct rt_workqueue *workqueue;
};
struct rt_delayed_work
{
struct rt_work work;
};
#ifdef RT_USING_HEAP
/**
* 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;
}
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

View File

@ -5,7 +5,8 @@
*
* Change Logs:
* 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>
@ -339,12 +340,6 @@ rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue)
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
static struct rt_workqueue *sys_workq;

View File

@ -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;
socklen_t addr_len = sizeof(struct sockaddr_in);
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"};
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)
{
rt_free(delay_work);
rt_free(work);
}
/* get network interface socket operations */
@ -287,18 +286,18 @@ int sal_check_netdev_internet_up(struct netdev *netdev)
#ifdef SAL_INTERNET_CHECK
/* 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)
{
LOG_W("No memory for network interface device(%s) delay work.", netdev->name);
return -1;
}
rt_delayed_work_init(net_work, check_netdev_internet_up_work, (void *)netdev);
rt_work_submit(&(net_work->work), RT_TICK_PER_SECOND);
rt_work_init(net_work, check_netdev_internet_up_work, (void *)netdev);
rt_work_submit(net_work, RT_TICK_PER_SECOND);
#endif /* SAL_INTERNET_CHECK */
return 0;
}
@ -1176,4 +1175,3 @@ void sal_freeaddrinfo(struct addrinfo *ai)
pf->netdb_ops->freeaddrinfo(ai);
}
}