Skip to content

Commit

Permalink
Add LanguagePlatform>>#newProcessNamed:evaluating:at:
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Nov 12, 2024
1 parent af3ccb2 commit d1c9ac3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ LanguagePlatform >> messageDigest: string [
^ self subclassResponsibility
]

{ #category : 'process scheduling' }
LanguagePlatform >> newProcessNamed: processName evaluating: block at: priority [

self subclassResponsibility
]

{ #category : 'accessing' }
LanguagePlatform >> os [
"Returns the underlying operating system abstraction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ PharoPlatform >> messageDigest: string [
^ SHA256 hashMessage: string
]

{ #category : 'process scheduling' }
PharoPlatform >> newProcessNamed: processName evaluating: block at: priority [

^ block newProcess
priority: priority;
name: processName;
yourself
]

{ #category : 'accessing' }
PharoPlatform >> os [

Expand Down
25 changes: 25 additions & 0 deletions source/Buoy-Metaprogramming-Tests/LanguagePlatformTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,31 @@ LanguagePlatformTest >> testMessageDigest [
2 208 191 55 201 229 146 ]
]

{ #category : 'tests' }
LanguagePlatformTest >> testNewProcessNamedEvaluatingAt [

| wasEvaluated semaphore process |
wasEvaluated := false.
semaphore := Semaphore new.

process := LanguagePlatform current
newProcessNamed: 'Testing LanguagePlatform fork'
evaluating: [
wasEvaluated := true.
semaphore signal
]
at: Processor userBackgroundPriority.

self
assert: process name equals: 'Testing LanguagePlatform fork';
assert: process priority equals: Processor userBackgroundPriority.

process resume.
semaphore wait.

self assert: wasEvaluated
]

{ #category : 'tests' }
LanguagePlatformTest >> testOSEnvironment [

Expand Down

0 comments on commit d1c9ac3

Please sign in to comment.