Merge pull request #3662 from BernardXiong/fix_pthreads

Fix pthreads
This commit is contained in:
Bernard Xiong 2020-06-06 15:32:34 +08:00 committed by GitHub
commit 08a8e75ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 10 deletions

View File

@ -17,10 +17,6 @@
#include <dfs_posix.h>
#endif
#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif
#ifdef RT_USING_MODULE
#include <dlmodule.h>
#endif

View File

@ -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 = []
# 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('pthreads', src,
depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH)
depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')

2
components/libc/pthreads/pthread.c Executable file → Normal file
View File

@ -277,7 +277,7 @@ int pthread_create(pthread_t *pid,
/* set pthread cleanup function and ptd data */
ptd->tid->cleanup = _pthread_cleanup;
ptd->tid->user_data = (rt_uint32_t)ptd;
ptd->tid->user_data = (rt_ubase_t)ptd;
/* start thread */
if (rt_thread_startup(ptd->tid) == RT_EOK)

View File

@ -623,7 +623,7 @@ struct rt_thread
void *lwp;
#endif
rt_uint32_t user_data; /**< private user data beyond this thread */
rt_ubase_t user_data; /**< private user data beyond this thread */
};
typedef struct rt_thread *rt_thread_t;