home *** CD-ROM | disk | FTP | other *** search
- *
- * tests for multiprocessing system
- *
- Declare Mtest Test
- Declare Future Object result sem
- Instance Mtest test
- Class Mtest
- all
- super all.
- 'all multiprocessing tests passed' print.
- |
- future | a f |
- a <- List new.
- f <- Future new; eval: [(1 to: 100) do: [:x | nil].
- a addLast: 2. 3].
- a addLast: 1.
- a addLast: f value.
- (a asArray = #(1 2 3))
- ifFalse: [ smalltalk error: 'future error'].
- 'future test passed' print
- ]
- Class Future
- new
- sem <- Semaphore new; set: 0
- |
- eval: aBlock
- [ result <- aBlock value. sem signal ] fork
- |
- value
- sem wait.
- sem signal.
- ^ result
- ]
-
-