Subj : Re: help with basic multithreading in C on solaris To : comp.programming.threads From : Winbatch Date : Sat Feb 26 2005 05:10 pm wrote in message news:1109437559.309802.280640@z14g2000cwz.googlegroups.com... > > Winbatch wrote: >> Hi, I'm trying to learn multithreading and it doesn't seem to be > working for >> me. I have a feeling it has to do with the fact that I'm writing to > files >> rather than to printf, but maybe not. Basically, I wanted to see if > it >> would be faster to write to 4 files at the same time (parallel) > rather than >> 4 in a row (serially). however, when my multithreaded code executes, > it >> seems to do them in order anyway (I expected to see Starting/Ending > all >> mixed rather than in order). Does anyone know what I'm doing wrong? > (Note, >> I also tried to do it with 4 different functions (ie, go, go1, go2, > etc.., >> but that didn't seem to fix it). > > What release of Solaris are you using? > If Solaris 7 or less, you are using the old libthread. > If Solaris 8, you are using the old libthread by default > but the alternate libthread is available for use (which > is the same as the only libthread in Solaris 9). > You cannot be using Solaris 9 or 10 because what you > report would not happen on these releases. > > If you create your threads with the PTHREAD_SCOPE_SYSTEM > attribute (see the pthread_attr_setscope() man page), > then you will get the behavior you want. > > Sorry for the non-obvious behavior of the old libthread. > > Roger Faulkner > Sun Microsystems > I'm on solaris 8, using verison 7 of the forte compiler. Can you give me some more info on how to use the alternative libthread on solaris 8? .