Skip to content

Commit

Permalink
Merge pull request #3092 from heplesser/fix-missing-thread-arg
Browse files Browse the repository at this point in the history
Ensure assert_valid_syn_id() is always called with correct thread id
  • Loading branch information
suku248 authored Feb 27, 2024
2 parents 0b2ebf3 + 23e0706 commit 1c4569f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions nestkernel/connection_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ nest::ConnectionManager::get_synapse_status( const size_t source_node_id,
const synindex syn_id,
const size_t lcid ) const
{
kernel().model_manager.assert_valid_syn_id( syn_id );
kernel().model_manager.assert_valid_syn_id( syn_id, kernel().vp_manager.get_thread_id() );

DictionaryDatum dict( new Dictionary );
( *dict )[ names::source ] = source_node_id;
Expand Down Expand Up @@ -253,7 +253,7 @@ nest::ConnectionManager::set_synapse_status( const size_t source_node_id,
const size_t lcid,
const DictionaryDatum& dict )
{
kernel().model_manager.assert_valid_syn_id( syn_id );
kernel().model_manager.assert_valid_syn_id( syn_id, kernel().vp_manager.get_thread_id() );

const Node* source = kernel().node_manager.get_node_or_proxy( source_node_id, tid );
const Node* target = kernel().node_manager.get_node_or_proxy( target_node_id, tid );
Expand Down Expand Up @@ -517,7 +517,7 @@ nest::ConnectionManager::connect( const size_t snode_id,
const double delay,
const double weight )
{
kernel().model_manager.assert_valid_syn_id( syn_id );
kernel().model_manager.assert_valid_syn_id( syn_id, kernel().vp_manager.get_thread_id() );

Node* source = kernel().node_manager.get_node_or_proxy( snode_id, target_thread );

Expand Down Expand Up @@ -546,7 +546,7 @@ nest::ConnectionManager::connect( const size_t snode_id,
const DictionaryDatum& params,
const synindex syn_id )
{
kernel().model_manager.assert_valid_syn_id( syn_id );
kernel().model_manager.assert_valid_syn_id( syn_id, kernel().vp_manager.get_thread_id() );

const size_t tid = kernel().vp_manager.get_thread_id();

Expand Down
4 changes: 2 additions & 2 deletions nestkernel/model_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void
ModelManager::set_synapse_defaults_( size_t model_id, const DictionaryDatum& params )
{
params->clear_access_flags();
assert_valid_syn_id( model_id );
assert_valid_syn_id( model_id, kernel().vp_manager.get_thread_id() );

std::vector< std::shared_ptr< WrappedThreadException > > exceptions_raised_( kernel().vp_manager.get_num_threads() );

Expand Down Expand Up @@ -337,7 +337,7 @@ ModelManager::get_synapse_model_id( std::string model_name )
DictionaryDatum
ModelManager::get_connector_defaults( synindex syn_id ) const
{
assert_valid_syn_id( syn_id );
assert_valid_syn_id( syn_id, kernel().vp_manager.get_thread_id() );

DictionaryDatum dict( new Dictionary() );

Expand Down
6 changes: 3 additions & 3 deletions nestkernel/model_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class ModelManager : public ManagerInterface
* Asserts validity of synapse index, otherwise throws exception.
* @throws UnknownSynapseType
*/
void assert_valid_syn_id( synindex syn_id, size_t t = 0 ) const;
void assert_valid_syn_id( synindex syn_id, size_t t ) const;

bool are_model_defaults_modified() const;

Expand Down Expand Up @@ -300,7 +300,7 @@ ModelManager::are_model_defaults_modified() const
inline ConnectorModel&
ModelManager::get_connection_model( synindex syn_id, size_t thread_id )
{
assert_valid_syn_id( syn_id );
assert_valid_syn_id( syn_id, thread_id );
return *( connection_models_[ thread_id ][ syn_id ] );
}

Expand All @@ -322,7 +322,7 @@ ModelManager::assert_valid_syn_id( synindex syn_id, size_t t ) const
inline SecondaryEvent&
ModelManager::get_secondary_event_prototype( const synindex syn_id, const size_t tid )
{
assert_valid_syn_id( syn_id );
assert_valid_syn_id( syn_id, tid );
return *get_connection_model( syn_id, tid ).get_secondary_event();
}

Expand Down

0 comments on commit 1c4569f

Please sign in to comment.