diff options
| author | Bernard Xiong <[email protected]> | 2021-03-02 15:00:43 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-02 15:00:43 +0800 |
| commit | 2c12493ff342ea9ba808311c3f6835eba31a8d3e (patch) | |
| tree | b1e1dfbeaead7c08ab8d7d0f34066154c125841b /components/libc/pthreads | |
| parent | 5f17cf9204e501d971cd28486e0a7193d2f1fae4 (diff) | |
| parent | 19871ac32e41590b1f3e3742d9ab023dc3147ba0 (diff) | |
Merge pull request #4404 from KyleChenjh/lts-v3.1.x
[Update] Sync from v4.0.3
Diffstat (limited to 'components/libc/pthreads')
| -rw-r--r-- | components/libc/pthreads/SConscript | 22 | ||||
| -rw-r--r-- | components/libc/pthreads/semaphore.c | 2 |
2 files changed, 18 insertions, 6 deletions
diff --git a/components/libc/pthreads/SConscript b/components/libc/pthreads/SConscript index 1b7b75bfd1..767b406d4c 100644 --- a/components/libc/pthreads/SConscript +++ b/components/libc/pthreads/SConscript @@ -1,10 +1,22 @@ from building import * +from utils import VersionCmp -cwd = GetCurrentDir() -src = Glob('*.c') -CPPPATH = [cwd] +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] +CPPDEFINES = [] -group = DefineGroup('pthreads', src, - depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH) +# only enable POSIX.1b-1993 Real-time extensions +libc_ver = GetDepend('LIBC_VERSION') +try: + ver = libc_ver.split(' ') + ver = ver[1] + if VersionCmp(ver, "2.5.0") == 1: + CPPDEFINES = ['_POSIX_C_SOURCE=199309L'] +except : + pass + +group = DefineGroup('libc', src, + depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) Return('group') diff --git a/components/libc/pthreads/semaphore.c b/components/libc/pthreads/semaphore.c index 2bef10022e..2ed93e99b6 100644 --- a/components/libc/pthreads/semaphore.c +++ b/components/libc/pthreads/semaphore.c @@ -64,7 +64,7 @@ static sem_t *posix_sem_find(const char* name) for (iter = posix_sem_list; iter != RT_NULL; iter = iter->next) { - object = (rt_object_t)&(iter->sem); + object = (rt_object_t)iter->sem; if (strncmp(object->name, name, RT_NAME_MAX) == 0) { |
