logo       

RE: BlockClosure>>fork problem: msg#00100

Subject: RE: BlockClosure>>fork problem
George,

Ohhhhh I'm really sorry.  It's funny now that I go back and look I'm
surprised that I missed that.  That's a horse of a different color.  

Basically to answer your question Transcript is not thread safe.  I'm not
sure exactly where it goes wrong but I suspect that it is probably doing a
copy somewhere and if one collection is used as a source and is copied at
the same time with two new additions then one gets lost.

To fix that you can set a semaphore which basically says don't try to access
Transcript from two places at exactly the same time.

semaphore := Monitor new.
[10 timesRepeat: [semaphore critical: [Transcript show: '2']]] fork.
[10 timesRepeat: [semaphore critical: [Transcript show: '1']]] fork.
Transcript cr.

This should make transcript thread safe.

Hope that helps, 

Ron Teitelbaum



> -----Original Message-----
> From: beginners-bounces@xxxxxxxxxxxxxxxxxxxxxxxxxx [mailto:beginners-
> bounces@xxxxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of George Herolyants
> Sent: Tuesday, February 20, 2007 3:28 PM
> To: A friendly place to get answers to even the most basic questions
> aboutSqueak.
> Subject: Re: [Newbies] BlockClosure>>fork problem
> 
> Thanks for this answer, Ron. But actually I'm not confused with order in
> wich '1' and '2' presents in result line. I can't understand why in some
> cases this code results ten '1' and ten '2' and in some cases it results
> ten '2' and only nine '1'?
> _______________________________________________
> Beginners mailing list
> Beginners@xxxxxxxxxxxxxxxxxxxxxxxxxx
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe