qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 0/5] Scoped locks using attribute((cleanup))


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH 0/5] Scoped locks using attribute((cleanup))
Date: Mon, 11 Dec 2017 22:32:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 11/12/2017 15:11, Eric Blake wrote:
> I don't know if there is a way to make gcc insert stack-unwind
> directives that are honored across longjmp (I know C++ does it for
> exceptions; so there may be a way, and I just don't know it).

Probably -fexceptions.

Paolo

> Conversely, I do know that pthread_cleanup_push/pop, which does
> something similar, is permitted by POSIX to NOT work across longjmp:
> 
>        Calling longjmp(3) (siglongjmp(3)) produces undefined  results
> if  any
>        call  has  been made to pthread_cleanup_push() or
> pthread_cleanup_pop()
>        without the matching call of the pair since the jump buffer was
> filled
>        by   setjmp(3)  (sigsetjmp(3)).   Likewise,  calling  longjmp(3)
> (sig‐
>        longjmp(3)) from inside a clean-up handler produces  undefined
> results
>        unless  the  jump  buffer  was  also filled by setjmp(3)
> (sigsetjmp(3))
>        inside the handler.


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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