-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding mutex locks in cache to prevent race conditions #185
Adding mutex locks in cache to prevent race conditions #185
Conversation
@MaartendeKruijf how do we test this? |
@MaartendeKruijf is this enough or should we do some more in-depth testing and such? |
@lucamrgs let met check |
35a59ac
to
c0557a9
Compare
@@ -85,7 +68,43 @@ func (cacheReporter *Cache) addExecution(newExecutionEntry cache_report.Executio | |||
return nil | |||
} | |||
|
|||
func (cacheReporter *Cache) GetExecutions() ([]cache_report.ExecutionEntry, error) { | |||
cacheReporter.mutex.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would gaurd the most critical sections in getExecutions and addExecutions. Also then just use a go routine to let the decomposer not wait on any mutex.
eb52553
to
3b83bde
Compare
@MaartendeKruijf both requested changes are implemented |
6317870
to
818cad4
Compare
|
||
// Lock | ||
cacheReporter.mutex.Lock() | ||
for _, executionEntryKey := range cacheReporter.fifoRegister { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user defer unlock if an error occurs the mutex will not be unlocked.
No description provided.