delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/28/13:40:35

Message-Id: <m0yUEJN-000S3IC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: Paul Derbyshire <pderbysh AT usa DOT net>, djgpp AT delorie DOT com
Date: Tue, 28 Apr 1998 14:44:00 +0000
MIME-Version: 1.0
Subject: Re: Some questions about operator new.
In-reply-to: <354560B9.BF464CF@usa.net>

Paul Derbyshire <pderbysh AT usa DOT net> wrote:

> 1. Is DJGPP's new thread-safe? Or would two threads doing allocation or   
> deletions simultaneously corrupt the arena?

new calls to malloc and the malloc in 2.01 isn't thread-safe at all. I didn't 
saw the code of the malloc in 2.02, but I think isn't thread-safe. Even more: 
How can you do a thread-safe malloc if the threads library isn't related to 
libc?
I think you must redefine new to call malloc but enclosing it with a 
lock/unclock call to the threads systems.

> 2. In 2.8.0 and later does new throw bad_alloc, or does it abort?
>    Is there a way to make it throw bad_alloc? Where the heck is
>    bad_alloc?

I don't know about 2.8.x but in 2.7.x you can define a function to be called 
when new fails. If you need more info just ask me (it works in 2.8.x too).

SET
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019