2013-01-08 22:40:58 +08:00
|
|
|
/*
|
2021-03-08 18:19:04 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2013-01-08 22:40:58 +08:00
|
|
|
*
|
2018-08-30 20:27:45 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2013-01-08 22:40:58 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
2018-08-30 20:27:45 +08:00
|
|
|
* Date Author Notes
|
|
|
|
* 2010-11-17 yi.qiu first version
|
2013-01-08 22:40:58 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include <rtm.h>
|
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
#include "dlmodule.h"
|
|
|
|
|
|
|
|
int dlclose(void *handle)
|
2013-01-08 22:40:58 +08:00
|
|
|
{
|
2018-08-30 20:27:45 +08:00
|
|
|
struct rt_dlmodule *module;
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
RT_ASSERT(handle != RT_NULL);
|
|
|
|
|
|
|
|
module = (struct rt_dlmodule *)handle;
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2018-08-30 20:27:45 +08:00
|
|
|
rt_enter_critical();
|
|
|
|
module->nref--;
|
|
|
|
if (module->nref <= 0)
|
|
|
|
{
|
|
|
|
rt_exit_critical();
|
|
|
|
|
|
|
|
dlmodule_destroy(module);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rt_exit_critical();
|
|
|
|
}
|
|
|
|
|
|
|
|
return RT_TRUE;
|
|
|
|
}
|
|
|
|
RTM_EXPORT(dlclose)
|