Invoking time-consuming JNI task as a thread

前端 未结 4 2098
慢半拍i
慢半拍i 2021-02-10 20:10

I\'m having a tough problem with invoking a native function using JNI from a thread.

The native function is legacy code that performs a computation-intensive task. Since

4条回答
  •  遥遥无期
    2021-02-10 20:36

    While you've got an answer, I don't think too much has been provided as to possible root cause. Here's a few possibilities, but there are others. Note, these apply to Windows.

    There's an apartment threaded COM object involved. Apartment threaded COM objects, which are the only type VB can create, can only be used on the thread that creates them.

    Security features, like impersonation, are often thread isolated. If the initialization code modified the context of the thread, future calls that expect the context to be in place will fail.

    Thread specific memory storage is a technique within some applications to support multi-threadedness (Java also has such a feature).

提交回复
热议问题