Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
clean up and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Apr 18, 2020
1 parent 96398ad commit 0ccf46e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/ThreadedFFI/TFCallbackQueue.class.st
Expand Up @@ -99,18 +99,19 @@ TFCallbackQueue >> initializeQueue [

{ #category : #private }
TFCallbackQueue >> lookupCallback: anExternalAddress [
"#registerCallback: and #lookupCallback: are protected by a mutex because I need to prevent
the execution of a collection grow while performing the lookup (this will move the elements
and may cause the lookup to fail).
Still, I am keeping a second lookup to ensure if a movement was done, I have another oportunity
to find the callback (just in case, I was not able to verify is actually needed)."

^ mutex critical: [
callbacksByAddress
at: anExternalAddress
ifAbsent: [
Stdio stdout << 'NOT FOUND: ' << anExternalAddress printString; lf.
Stdio stdout << callbacksByAddress printString; lf.
callbacksByAddress
at: anExternalAddress
ifAbsent: [
Stdio stdout << 'STILL NOT FOUND'; lf.
nil ] ] ]
ifAbsent: [ nil ] ] ]
]

{ #category : #private }
Expand Down Expand Up @@ -140,6 +141,9 @@ TFCallbackQueue >> primitiveInitializeQueueWith: anInteger [

{ #category : #operations }
TFCallbackQueue >> registerCallback: aCallback [
"#registerCallback: and #lookupCallback: are protected by a mutex because I need to prevent
the execution of a collection grow while performing the lookup (this will move the elements
and may cause the lookup to fail)."

mutex critical: [
callbacksByAddress
Expand Down

0 comments on commit 0ccf46e

Please sign in to comment.