xref: /nrf52832-nimble/rt-thread/components/libc/libdl/dlclose.c (revision 167494296f0543431a51b6b1b83e957045294e05)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2010-11-17     yi.qiu       first version
9  */
10 
11 #include <rtthread.h>
12 #include <rtm.h>
13 
14 #include "dlmodule.h"
15 
16 int dlclose(void *handle)
17 {
18     struct rt_dlmodule *module;
19 
20     RT_ASSERT(handle != RT_NULL);
21 
22     module = (struct rt_dlmodule *)handle;
23 
24     rt_enter_critical();
25     module->nref--;
26     if (module->nref <= 0)
27     {
28         rt_exit_critical();
29 
30         dlmodule_destroy(module);
31     }
32     else
33     {
34         rt_exit_critical();
35     }
36 
37     return RT_TRUE;
38 }
39 RTM_EXPORT(dlclose)
40