pthread_kill

Name

pthread_kill -- send a signal to a thread

Synopsis

       #include <rtl_signal.h>
       #include <rtl_sched.h>

       int pthread_kill(pthread_t thread,signo);

DESCRIPTION

This function is a standard POSIX threads function. pthread_kill sends signal signo to the realtime thread thread previously created by a call to pthread_create. pthread_kill is a fast and deterministic function if called on threads running on the same processor as the calling thread or interrupt handler. pthread_kill can be used to send signals to threads running on other than current CPU, but this is a more expensive operation and there may be delays before the signal will be detected by the target thread.

RETURN VALUE

pthread_kill returns 0 on success and a non-zero error code on error.

ERRORS

ESRCH

No thread could be found corresponding to that specified by the given thread ID.

AUTHOR

Victor Yodaiken (support@fsmlabs.com)

NOTES

pthread_kill is safe to call from a signal handler, a thread and from Linux kernel code. pthread_kill is one of the primary means of sending signals to the general purpose operating system (Linux). A call pthread_kill(pthread_linux(),RTL_LINUX_MIN_SIGNA+n) for an integer value n will generate irq n in the Linux thread.

pthread_kill(pthread_linux(),RTL_SIG_SUSPEND_LINUX) sends the Linux thread on the highest numbered processor an interrupt that will force Linux to suspend itself and to tell the hardware to ignore all non-RTLinux interrupts (if possible). This allows a processor on an SMP system to be dedicated to RTLinux. To restore suspended Linux threads, in order, use RTL_SIG_RESTART_LINUX. The RESERVE_PROCESSOR config option must be selected when building RTLinux to enable this feature.

SEE ALSO

pthread_create(3), pthread_linux(3)

©2001 FSMLabs Inc.

All rights reserved.