Skip to content
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

Multiple-Reader/Single-Writer locks, or "Busy" flag for workspace access #5401

Closed
mantid-builder opened this issue Jan 18, 2012 · 1 comment
Milestone

Comments

@mantid-builder
Copy link
Collaborator

Original Reporter: @jzikovsky

Original Owner: @jzikovsky

Refs http://trac.mantidproject.org/mantid/ticket/4516: It is possible to have destructive access to a workspace (via the PlusMD algorithm, for example), while the GUI thread is busy accessing it to draw it.

We can prevent segfaults by either: implementing a "busy" flag on workspaces, or by using Multiple-Reader/Single-Writer locks.

http://stackoverflow.com/questions/989795/example-for-boost-shared-mutex-multiple-reads-one-write

Investigate.

Edit: Here is a sample script that could cause segfaults if using GUI views on the MDW workspace while the loop runs:

import numpy as np

CreateMDWorkspace(Dimensions='3',Extents='0,10,0,10,0,10',Names='x,y,z',Units='m,m,m',MaxRecursionDepth='20',OutputWorkspace='mdw', SplitInto='2', SplitThreshold='150')
FakeMDEventData(InputWorkspace='mdw',UniformParams='1e+05')
plotSlice('mdw')

num = 100
xs = np.random.rand(num)*10.0
ys = np.random.rand(num)*10.0
zs = np.random.rand(num)*10.0
for (x,y,z) in zip(xs, ys, zs):
    CreateMDWorkspace(Dimensions='3',Extents='0,10,0,10,0,10',Names='x,y,z',Units='m,m,m',MaxRecursionDepth='20',OutputWorkspace='extra')
    FakeMDEventData(InputWorkspace='extra',PeakParams='1e4, %g,%g,%g, 0.5'% (x,y,z))
    PlusMD('mdw', 'extra', OutputWorkspace='mdw')
    PlusMD('mdw', 'extra', OutputWorkspace='mdw')
    PlusMD('mdw', 'extra', OutputWorkspace='mdw')
    PlusMD('mdw', 'extra', OutputWorkspace='mdw')
@mantid-builder
Copy link
Collaborator Author

This issue was originally trac ticket 4554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant