Как получить доступ к pthread api с помощью проекта Панама - PullRequest
0 голосов
/ 09 июня 2019

Я экспериментировал с ранними сборками проекта Панама и успешно запустил некоторые примеры.

К сожалению, я не могу взаимодействовать с нативным API pthread из-за внутренних исключений.

Вот что я попробовал:

jextract \
    --exclude-symbols "PTHREAD_CREATE_JOINABLE" \
    --exclude-symbols "PTHREAD_CREATE_DETACHED" \
    --exclude-symbols "PTHREAD_INHERIT_SCHED" \
    --exclude-symbols "PTHREAD_EXPLICIT_SCHED" \
    --exclude-symbols "PTHREAD_SCOPE_SYSTEM" \
    --exclude-symbols "PTHREAD_SCOPE_PROCESS" \
    --exclude-symbols "PTHREAD_PROCESS_PRIVATE" \
    --exclude-symbols "PTHREAD_PROCESS_SHARED" \
    --exclude-symbols "PTHREAD_CANCEL_ENABLE" \
    --exclude-symbols "PTHREAD_CANCEL_DISABLE" \
    --exclude-symbols "PTHREAD_CANCEL_DEFERRED" \
    --exclude-symbols "PTHREAD_CANCEL_ASYNCHRONOUS" \
    /usr/include/pthread.h -t unix.pthread -o pthread.jar
...
var t = Libraries.bind(MethodHandles.lookup(), pthread.class);

приведенные выше броски фрагмента:

Exception in thread "main" jdk.internal.foreign.memory.DescriptorParser$InvalidDescriptorException: Illegal char in ident: [u32(__low)u32(__high)](ano
n$thread-_shared-types_h$6259
        at java.base/jdk.internal.foreign.memory.DescriptorParser$DescriptorScanner.error(DescriptorParser.java:538)
        at java.base/jdk.internal.foreign.memory.DescriptorParser.parseIdent(DescriptorParser.java:370)
        at java.base/jdk.internal.foreign.memory.DescriptorParser.parseAnnotation(DescriptorParser.java:229)
        at java.base/jdk.internal.foreign.memory.DescriptorParser.annotationsOpt(DescriptorParser.java:220)
        at java.base/jdk.internal.foreign.memory.DescriptorParser.annotatedOpt(DescriptorParser.java:214)
        at java.base/jdk.internal.foreign.memory.DescriptorParser.parseGroup(DescriptorParser.java:305)
        at java.base/jdk.internal.foreign.memory.DescriptorParser.parseLayout(DescriptorParser.java:99)
        at java.base/jdk.internal.foreign.Util.layoutof(Util.java:154)
        at java.base/jdk.internal.foreign.LayoutResolver.addNameIfNeeded(LayoutResolver.java:89)
        at java.base/jdk.internal.foreign.LayoutResolver.addClass(LayoutResolver.java:73)
        at java.base/jdk.internal.foreign.LayoutResolver.addClass(LayoutResolver.java:82)
        at java.base/jdk.internal.foreign.LayoutResolver.addClass(LayoutResolver.java:77)
        at java.base/jdk.internal.foreign.LayoutResolver.addClass(LayoutResolver.java:77)
        at java.base/jdk.internal.foreign.LayoutResolver.<init>(LayoutResolver.java:47)
        at java.base/jdk.internal.foreign.LayoutResolver$1.computeValue(LayoutResolver.java:60)
        at java.base/jdk.internal.foreign.LayoutResolver$1.computeValue(LayoutResolver.java:57)
        at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:226)
        at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:208)
        at java.base/java.lang.ClassValue.get(ClassValue.java:114)
        at java.base/jdk.internal.foreign.LayoutResolver.get(LayoutResolver.java:68)
        at java.base/jdk.internal.foreign.BinderClassGenerator.<init>(BinderClassGenerator.java:92)
        at java.base/jdk.internal.foreign.HeaderImplGenerator.<init>(HeaderImplGenerator.java:80)
        at java.base/jdk.internal.foreign.LibrariesHelper$3.computeValue(LibrariesHelper.java:133)
        at java.base/jdk.internal.foreign.LibrariesHelper$3.computeValue(LibrariesHelper.java:126)
        at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:226)
        at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:208)
        at java.base/java.lang.ClassValue.get(ClassValue.java:114)
        at java.base/jdk.internal.foreign.LibrariesHelper.getHeaderImplClass(LibrariesHelper.java:157)
        at java.base/jdk.internal.foreign.LibrariesHelper.bind(LibrariesHelper.java:256)
        at java.base/jdk.internal.foreign.LibrariesHelper.bind(LibrariesHelper.java:275)
        at java.base/java.foreign.Libraries.bind(Libraries.java:63)

Я что-то упустил или pthread не поддерживается проектом?

...