[Insight-developers] RE: SGI builds and libCio.a

Brad King brad.king@kitware.com
Wed, 12 Mar 2003 13:45:25 -0500 (EST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---1463810815-226517816-1047494387=:12985
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.LNX.4.44.0303121340001.12985@hythloth.kitwarein.com>

> No. Multiprocessor sgi. Any test that had I/O would crash.
> Multiprocessor suns work fine. Don't change anything that will affect
> them please.
> > The original problem can from a multiprocessor Sun didn't it?

I think the problem was originally on a multiprocessor Sun, and was solved
by adding -D_PTHREADS.  Adding that caused ANY sgi machine to crash when
doing I/O with the ansi std library.

I've attached what I think is the last version of the small test program
Jim Miller and I used to recreate the problem on the multiprocessor sun.
If it wasn't the last version, Jim has a slightly more recent one
somewhere.

Build it with

  CC thread1.cxx -lthread

(or maybe with gcc?) and run it with the number of threads as the first
command line argument.  If it is built with -D_PTHREADS defined, it works
fine.  Otherwise, it fails almost immediately.  Once you have duplicated
this behavior on the sun, try it on the SGI.  I bet it will work fine.
The default SGI STL behavior is to use SPROC (SGI's native spin-locks) for
thread safety.

I think the solution is to remove the SGI std library and define _PTHREADS
only on the Sun.

-Brad

---1463810815-226517816-1047494387=:12985
Content-Type: TEXT/X-C++SRC; NAME="thread1.cxx"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.44.0303121339470.12985@hythloth.kitwarein.com>
Content-Description: 
Content-Disposition: ATTACHMENT; FILENAME="thread1.cxx"

I2luY2x1ZGUgPGlvc3RyZWFtPg0KI2luY2x1ZGUgPGxpc3Q+DQojaW5jbHVk
ZSA8cHRocmVhZC5oPg0KI2luY2x1ZGUgPHVuaXN0ZC5oPg0KDQp2b2lkKiBy
dW5uZXIodm9pZCopOw0Kdm9pZCBydW5fdGhyZWFkKGludCB0bnVtKTsNCg0K
aW50IGRvbmUgPSAwOw0KaW50IG1haW4oaW50I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