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

[REBOL] Multiple Threads Crash

From: sanghabum:aol at: 23-Jul-2001 19:01

Hi all, The code below is something I started writing to get a feel for Rebol's undocumented concurrent and muti-threading capabilities, and to verify where and what sort of serialisation code I need to build into my applications. (Jeff will be pleased to know that I had it in my mind to turn my discoveries into a Zine article). Unfortunately, it's crash prone. If I click the buttons furiously, it crashes (Win 98) with a "Rebol has performed an illegal operation..." message at around 70-80 active threads. If I click a bit more sedately to keep the thread level around 50 or so, it soon crashes with a Rebol console error: "Invalid data type during recycle ** Press enter to quit..." Two questions for anyone out there interested: 1. Is it a Windows problem, or a fault with Rebol (View 1.2.1.3.1 21-Jun-2001)? 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 way of avoiding it this time. Any suggestions. --Thanks as usual, --Colin. ======================= Rebol [title: "multi threads test"] Threads-Count: 0 ChangeBoxes: func [new-color [String!] speedfactor [Integer!] /local nn ] [ BumpThreads 1 print ["Go " new-color " started"] for nn 1 20 1 [ do join "box-" [nn "/color: " New-Color] do join "show box-" nn wait random (speedfactor / 200) ] ; for print ["Go " new-color " ended"] BumpThreads -1 return true ] ; fund BumpThreads: func [n [integer!]] [ Threads-Count: Threads-Count + n Threads-on-the-go/Text: Threads-Count Show Threads-on-the-go ] ; func testlayout: layout [ across box-1: box 50x50 red box-2: box 50x50 red box-3: box 50x50 red box-4: box 50x50 red box-5: box 50x50 red return box-6: box 50x50 red box-7: box 50x50 red box-8: box 50x50 red box-9: box 50x50 red box-10: box 50x50 red return box-11: box 50x50 red box-12: box 50x50 red box-13: box 50x50 red box-14: box 50x50 red box-15: box 50x50 red return box-16: box 50x50 red box-17: box 50x50 red box-18: box 50x50 red box-19: box 50x50 red box-20: box 50x50 red 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 testlayout halt ======================= (if you have a faster/slower machine, you may need to adjust the timing factors).