Skip to content
Snippets Groups Projects
SharedHashMap.cpp 565 B
Newer Older
  • Learn to ignore specific revisions
  • //
    // Created by Jake Close on 3/18/18.
    //
    
    #include "SharedHashMap.h"
    
    
    
    vcday's avatar
    vcday committed
    template< class T >
    void SharedHashMap::Insert ( T key, T value )
    
    vcday's avatar
    vcday committed
    	pthread_mutex_lock( &m );
    
    vcday's avatar
    vcday committed
    	map.insert( key, value );
    
    vcday's avatar
    vcday committed
    	pthread_mutex_unlock( &m );
    
    vcday's avatar
    vcday committed
    template< class T >
    T void SharedHashMap::Find ( T key )
    
    vcday's avatar
    vcday committed
    	pthread_mutex_lock( &m );
    
    vcday's avatar
    vcday committed
    	T value = map.find( key );
    
    vcday's avatar
    vcday committed
    	pthread_mutex_unlock( &m );
    
    vcday's avatar
    vcday committed
    template< class T >
    size_t ProducerConsumerQueue< T >::Size ( )
    
    vcday's avatar
    vcday committed
    	pthread_mutex_lock( &m );
    	size_t size = map.size( );
    	pthread_mutex_unlock( &m );