mcdougallab / matlabneuroninterface

Interface for connecting NEURON and MATLAB
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

Session destructor #95

Open edovanveen opened 10 months ago

edovanveen commented 10 months ago

Session currently has no destructor, because we cannot terminate the neuron process while inprocess:

>> neuronConfig = clibConfiguration("neuron")

neuronConfig =

  CLibraryConfiguration for neuron with properties:

    InterfaceLibraryPath: "Z:\Git\matlabneuron\neuron\neuronInterface.dll"
               Libraries: ["Z:\Git\matlabneuron\source\libnrniv.a"    "C:\Program Files\MATLAB\R2023b\extern\lib\win64\mingw64\libmex.lib"]
                  Loaded: 1
           ExecutionMode: inprocess
               ProcessID: 4872

>> neuronConfig.unload
Error using matlab.cppclient.CLibraryConfiguration/unload
Unloading of library is not supported for 'inprocess' execution mode. Restart MATLAB to unload and then call
'clibConfiguration('neuron','ExecutionMode','outofprocess')'.

Is there another way to terminate neuron, so we can implement a Session destructor?

Once Session has a destructor, we can also add a mlock and munlock to keep it in memory after a clear all, to make it more singleton-esque.