mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
c2e42f4ef4
- Split VariableServerThread into VariableServerSession and VariableReference classes - Use C++ streams for data handling - Unit tests
35 lines
1018 B
C++
35 lines
1018 B
C++
|
|
#include <iostream>
|
|
#include <sys/time.h>
|
|
|
|
#include "trick/VariableServer.hh"
|
|
#include "trick/variable_server_proto.h"
|
|
#include "trick/variable_server_sync_types.h"
|
|
#include "trick/TrickConstant.hh"
|
|
|
|
int Trick::VariableServer::freeze_init() {
|
|
|
|
long long next_call_tics ;
|
|
VariableServerSession * session ;
|
|
std::map < pthread_t , VariableServerSession * >::iterator it ;
|
|
|
|
next_call_tics = TRICK_MAX_LONG_LONG ;
|
|
|
|
pthread_mutex_lock(&map_mutex) ;
|
|
for ( it = var_server_sessions.begin() ; it != var_server_sessions.end() ; it++ ) {
|
|
session = (*it).second ;
|
|
session->freeze_init() ;
|
|
if ( session->get_freeze_next_tics() < next_call_tics ) {
|
|
next_call_tics = session->get_freeze_next_tics() ;
|
|
}
|
|
}
|
|
pthread_mutex_unlock(&map_mutex) ;
|
|
|
|
//reschedule the current job. TODO: a call needs to be created to do this the OO way
|
|
if ( copy_data_freeze_job != NULL ) {
|
|
copy_data_freeze_job->next_tics = next_call_tics ;
|
|
}
|
|
|
|
return(0) ;
|
|
}
|