trick/trick_source/sim_services/Executive/Threads.cpp
Alex Lin 19025d77ad Standardize directory names
Reorganized.  Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory.  Created a libexec directory that holds all of the executables that users don't need to execute directly.  Changed all of the executables remaining in bin to start with "trick-".  In the sim_services directories changed all source files to find the Trick headers in their new location.  Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level.  Moved the makefiles, docs, man, and other architecture independent files into a top level share directory.  Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on.

refs #63
2015-06-09 08:44:42 -05:00

57 lines
1.5 KiB
C++

#include <iostream>
#include <sstream>
#include <stdio.h>
#include "trick/Threads.hh"
#include "trick/message_proto.h"
Trick::Threads::Threads(int in_id , bool in_rt_nap) :
enabled(true) ,
thread_id(in_id) ,
curr_time_tics(0) ,
amf_cycle(0.0) ,
amf_cycle_tics(0) ,
amf_next_tics(0) ,
curr_job(NULL) ,
rt_nap(in_rt_nap) ,
process_type(PROCESS_TYPE_SCHEDULED) ,
child_complete(false) ,
frame_trigger(0) ,
running(false) ,
rt_semaphores(true) ,
shutdown_wait_async(false) {
pthread_cond_init(&go_cv, NULL);
pthread_mutex_init(&go_mutex, NULL);
std::stringstream oss ;
oss << "Child_" << in_id ;
name = oss.str() ;
}
void Trick::Threads::set_pthread_id(pthread_t in_pthread_id) {
pthread_id = in_pthread_id ;
}
void Trick::Threads::set_enabled( bool in_enabled ) {
enabled = in_enabled ;
}
void Trick::Threads::clear_scheduled_queues() {
job_queue.clear() ;
top_of_frame_queue.clear() ;
end_of_frame_queue.clear() ;
}
void Trick::Threads::dump( std::ostream & oss ) {
oss << "Trick::Threads (" << name << ")" << std::endl ;
oss << " process_type = " ;
switch ( process_type ) {
case PROCESS_TYPE_SCHEDULED: oss << "scheduled" << std::endl ; break ;
case PROCESS_TYPE_ASYNC_CHILD: oss << "asynchronous" << std::endl ; break ;
case PROCESS_TYPE_AMF_CHILD: oss << "asynchronous must finish with amf_cycle = " << amf_cycle << std::endl ; break ;
}
oss << " number of scheduled jobs = " << job_queue.size() << std::endl ;
Trick::ThreadBase::dump(oss) ;
}