libc: extent vbox specific pthread_create API

Make it possible to adopt normal Genode::Threads for use within in a
pthread environment.

Issue #3164.
This commit is contained in:
Josef Söntgen 2019-02-18 15:56:07 +01:00 committed by Norman Feske
parent 2f33d44713
commit 5bab5f4cca
3 changed files with 15 additions and 0 deletions

View File

@ -948,6 +948,7 @@ _ZN16Pthread_registry6insertEP7pthread T
_ZN16Pthread_registry6removeEP7pthread T
_ZN16Pthread_registry8containsEP7pthread T
_ZN4Libc14pthread_createEPP7pthreadPFPvS3_ES3_mPKcPN6Genode11Cpu_sessionENS8_8Affinity8LocationE T
_ZN4Libc14pthread_createEPP7pthreadRN6Genode6ThreadE T
#
# Libc plugin interface

View File

@ -37,6 +37,18 @@ int Libc::pthread_create(pthread_t *thread,
}
int Libc::pthread_create(pthread_t *thread, Genode::Thread &t)
{
pthread_t thread_obj = new pthread(t);
if (!thread_obj)
return EAGAIN;
*thread = thread_obj;
return 0;
}
extern "C"
{
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,

View File

@ -21,4 +21,6 @@ namespace Libc {
void *(*start_routine) (void *), void *arg,
size_t stack_size, char const * name,
Genode::Cpu_session * cpu, Genode::Affinity::Location location);
int pthread_create(pthread_t *, Genode::Thread &);
}