guile-user
[Top][All Lists]
Advanced

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

Re: The equivalent of racket's break-thread in guile?


From: Xin Wang
Subject: Re: The equivalent of racket's break-thread in guile?
Date: Sun, 2 Jun 2013 07:27:10 +0800




2013/5/31 Chaos Eternal <address@hidden>
IMHO, that means if you send a signal other than SIGSTOP SIGCONT
SIGKILL or SIGTERM, the signal will not affect the whole process.
also, SIGSTOP/SIGCONT and SIGKILL are un-catchable signals, they are
not offten used.
according the pthread_kill(3), you can send arbitrary signal to a
thread and, according to guile's manual, such signals can be catched.
they are just asyncs.

references:
pthread_kill(3)
6.21.2.1 System asyncs of guile manual.

I think there are two things that are global in pthread of linux:

1. signal handlers, there no corresponding pthread version of sigaction, so we can only establish signal handlers globally.
2. singals that take disposition of "stop", "continue", "terminate" will effect whole process. signal(7) descrriables default dispositions of signals.

So for example, if we do not catch SIGUSR1, it will kill the whole process, as its default action is terminate, and if we catch SIGTERM, it will not affect whole process.
 

On Fri, May 31, 2013 at 2:55 PM, Nala Ginrut <address@hidden> wrote:
> On Fri, 2013-05-31 at 14:24 +0800, Xin Wang wrote:
>
>>
>>
>> Thank you for pointing out this.
>>
>>
>> After some more search, I found that pthread has function pthread_kill
>> [1], which can be used to send signal to specific thread.
>>
>>
>> No sure if it can be used to implement similar behaviour.
>>
>>
>> [1]
>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_kill.html
>
>
> At least in Linux, pthread_kill may effect the whole process:
> ----------------------------cut----------------------------------
> Signal  dispositions  are  process-wide: if a signal handler is
> installed, the handler will be invoked in the thread thread,
> but if the disposition of the signal is "stop", "continue", or
> "terminate", this action will affect the whole process.
> ----------------------------end----------------------------------
>
> The real solution for your purpose is green-thread IMO.
>
>
>>
>>
>>         > Regards,
>>         > Xin Wang
>>
>>
>>
>>
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]