Re: signals handling in kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 14, 2015 at 6:38 PM, KASHISH BHATIA
<kashish.bhatia1989@xxxxxxxxx> wrote:
> I want to write a module which will spawn two kthreads where kthread-1 will
> send signal X to kthread-2 and kthread-2 has registered a signal handler to
> catch signal X. When the signal X is caught by kthread-2, it will execute
> its signal handler.

Again instead of signal, let's call it notification. I'm not saying
it's not possible cuz I've not done it but there are other
alternatives.

In your kthread loop, you check for condition <to_do_something>, then
continue or exit based on that notification. Even with
signals you'll have something like recalc_sigpending and then take
action on that signal, usually exiting from that thread but
this logic needs to be in that kthread loop.  Your kthread may well
continue if you so choose to ignore signals altogether.


>
> Just am exploring signal handing and its intricacies, so thought of this
> exercise. Is it possible ?

Have you checked how signals are sent and handled within kernel?

>
> On Fri, Aug 14, 2015 at 6:10 PM, Pranay Srivastava <pranjas@xxxxxxxxx>
> wrote:
>>
>> On Fri, Aug 14, 2015 at 5:38 PM, KASHISH BHATIA
>> <kashish.bhatia1989@xxxxxxxxx> wrote:
>> >
>> > Is it possible to send signal from one kthread to another kthread using
>> > signal apis defined in signal.h and signal.c. Also I want to override the
>> > default behavior of a signal handler. How can I achieve this ?
>> >
>> You probably want to do a "notify?" i think.  Care to elaborate more
>> on what exactly you are trying to do? If it's information you need to
>> pass between 2 kthreads then signal handling is not a good idea there
>> are other mechanisms you can use.
>>
>>
>> >
>> > --
>> >
>> > Regards,
>> > Kashish Bhatia
>> >
>> > _______________________________________________
>> > Kernelnewbies mailing list
>> > Kernelnewbies@xxxxxxxxxxxxxxxxx
>> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>>
>>
>>
>> --
>>         ---P.K.S
>
>
>
>
> --
>
> Regards,
> Kashish Bhatia



-- 
        ---P.K.S

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux