Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Multiple Threads Crash

From: joel:neely:fedex at: 23-Jul-2001 18:38

Hi, Colin, [Sanghabum--aol--com] wrote:
> 2. If been ticked off before for "DO"ing a string and have > tried to mend my ways. But I don't see a straightforward wa > of avoiding it this time. Any suggestions. >
Yes. Put your boxes in a block and iterate across that. One quick-and-dirty way to do it is as follows: 8<------------------------------------------------------------ boxcol: make object! [ Threads-Count: 0 boxes: [] ChangeBoxes: func [ new-color [tuple!] speedfactor [Integer!] /local nn ][ BumpThreads 1 print ["Go " new-color " started"] foreach a-box boxes [ a-box/color: new-color show a-box wait random (speedfactor / 200) ] print ["Go " new-color " ended"] BumpThreads -1 return true ] BumpThreads: func [n [integer!]] [ Threads-Count: Threads-Count + n Threads-on-the-go/Text: Threads-Count Show Threads-on-the-go ] testlayout: layout [ across a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] return a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] return a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] return a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] a-box: box 50x50 red do [append boxes a-box] return threads-on-the-go: info 50x50 Center Middle font-size 20 Return Button "go Blue" [ChangeBoxes blue 5] Button "go Yellow" [ChangeBoxes yellow 10] Button "go White" [ChangeBoxes white 12] Return Button "go Red" [ChangeBoxes red 15] Button "go Pink" [ChangeBoxes pink 2] Button "go Green" [ChangeBoxes green 1] ] ] unview/all view boxcol/testlayout halt 8<------------------------------------------------------------ -- This sentence contradicts itself -- no actually it doesn't. -- Doug Hofstadter joel<dot>neely<at>fedex<dot>com