assert semantic change proposal

via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 7 03:02:28 PDT 2014


On Thursday, 7 August 2014 at 09:26:01 UTC, Walter Bright wrote:
> On 8/7/2014 2:10 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
>> On Wednesday, 6 August 2014 at 21:57:50 UTC, Walter Bright 
>> wrote:
>>> On 8/6/2014 10:18 AM, Sean Kelly wrote:
>>>> So from a functional perspective, assuming this is a 
>>>> multithreaded app, what
>>>> should the procedure be when an AssertError is thrown in 
>>>> some thread?
>>>
>>> Print message, stop the process and all its threads.
>>>
>>> Rationale: the program is in an unknown, invalid state, which 
>>> will include any
>>> thread (or process) that has access to memory shared with 
>>> that failed thread.
>>
>> Strictly speaking we would need to kill only those threads.
>
> No, all the threads. Threads share memory, so corruption can 
> spread from one to the next.

Yes, that's what I was saying: "those threads ... that ha[ve] 
access to memory shared with that failed thread".

But even without real sharing of memory, a failed assertion in 
one thread might result from invalid data being sent to that 
thread from another one (via spawn or send). Better to just kill 
all threads.


More information about the Digitalmars-d mailing list