Home

On Sep 25, 5:44 pm, hyderabadblues <sirishku...@gmail.com> wrote:

> I have a doubt regarding the asserts. I have multiple threads
> running, is there any chance that there can be assert in two
> threads at the same time.

Sure. The usual access rules apply to any variables used in the
assert (so you may need to protect it with a lock).

Of course, once an assert fails, you're over and done with. A
failed assertion calls abort(), which normally brings the whole
process down with a bang, by means of a SIGABRT. According to
the language standard (and Posix), if there is a signal handler
for this signal, and it returns, "The abort function causes
abnormal program termination to occur, unless the signal SIGABRT
is being caught and the signal handler does not return."

(I'm not sure of all of the details, but under Posix, at least,
the signal is delivered to the process, not just the thread.
I'm also not too sure what happens if one of the threads is in a
sigwait on SIGABRT, either. At least under Solaris, it doesn't
seem that you can successfully catch it with a sigwait, or block
it with pthread_sigmask.)

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

previous
next

Re: python 2.5 and 3gb switch
Re: java, c or c++
Re: A question about the std::set<>::iterator
Re: Global objects...
Re: Processing drag & drop on the desktop
gustowne meble katowice
poker
endermologia warszawa
serwis wózków widłowych
tusze do drukarek