I am trying to send a signal from a native thread (created via
pthread_create()) to the SDK thread.
Here is how I'm doing it:
- In the JNI method that is invoked from SDK space, create a native
thread using pthread_create().
- Now wait inside the JNI method using sigwait(). This wait is
happening in the SDK thread context.
- Have the newly created native thread send a signal(SIGUSR1) to SDK
thread via pthread_kill()
The pthread_kill() call from native thread fails with error EPERM.
If I try to send the same signal from SDK thread to the native thread,
it works fine. The pthread_kill() call succeeds and the native thread
is woken up correctly in this case.
Is it possible to send signal to SDK thread from NDK thread? Is there
any other way of sending signal except pthread_kill()?
Thanks
B
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
On Apr 6, 6:41 pm, David Turner <di...@android.com> wrote:
> the EPERM error probably comes from the fact that you don't have the
> pthread_t of the SDK thread, but something else.
>
> On Tue, Apr 6, 2010 at 6:40 PM, David Turner <di...@android.com> wrote:
> > Why are you using signals anyway, they suck enormously for a variety of
> > reasons.
> > What are you trying to achieve here ?
>
> > On Tue, Apr 6, 2010 at 6:28 PM, B Zen <biren...@gmail.com> wrote:
>
> >> Hi,
>
> >> I am trying to send a signal from a native thread (created via
> >> pthread_create()) to the SDK thread.
>
> >> Here is how I'm doing it:
>
> >> - In the JNI method that is invoked from SDK space, create a native
> >> thread using pthread_create().
> >> - Now wait inside the JNI method using sigwait(). This wait is
> >> happening in the SDK thread context.
> >> - Have the newly created native thread send a signal(SIGUSR1) to SDK
> >> thread via pthread_kill()
>
> >> The pthread_kill() call from native thread fails with error EPERM.
>
> >> If I try to send the same signal from SDK thread to the native thread,
> >> it works fine. The pthread_kill() call succeeds and the native thread
> >> is woken up correctly in this case.
>
> >> Is it possible to send signal to SDK thread from NDK thread? Is there
> >> any other way of sending signal except pthread_kill()?
>
> >> Thanks
> >> B
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "android-ndk" group.
> >> To post to this group, send email to andro...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> android-ndk...@googlegroups.com<android-ndk%2Bunsu...@googlegroups.com>