diff --git a/include/trick/FrameDataRecordGroup.hh b/include/trick/FrameDataRecordGroup.hh index 45505336..48f451ba 100644 --- a/include/trick/FrameDataRecordGroup.hh +++ b/include/trick/FrameDataRecordGroup.hh @@ -65,11 +65,11 @@ namespace Trick { /** Thread start time */ long long start_time ; - /** Thread total frame scheduled time in tics*/ + /** Thread total frame scheduled time in tics */ long long frame_sched_time ; - /** Thread total frame scheduled time in seconds*/ - double frame_time ; + /** Thread total frame scheduled time in seconds */ + double frame_time ; // trick_units(s) } ; diff --git a/include/trick/IPPython.hh b/include/trick/IPPython.hh index 6174049a..5e9a8467 100644 --- a/include/trick/IPPython.hh +++ b/include/trick/IPPython.hh @@ -17,7 +17,6 @@ #define IPPYTHON_HH #include -#include #include "trick/InputProcessor.hh" namespace Trick { @@ -36,9 +35,6 @@ namespace Trick { /** Returned value from event condition evaluation.\n */ int return_val ; /**< trick_io(**) trick_units(--) */ - /** Input processor mutex for protection for var server and event processing.\n */ - pthread_mutex_t ip_mutex; /**< trick_io(**) trick_units(--) */ - /** @brief Constructor. */ diff --git a/include/trick/JobData.hh b/include/trick/JobData.hh index c92d1756..8ad72103 100644 --- a/include/trick/JobData.hh +++ b/include/trick/JobData.hh @@ -92,7 +92,7 @@ namespace Trick { long long frame_time ; /**< trick_io(**) */ /** Cumulative time in seconds used for job in frame (rt_stop_time - rt_start_time) / time_tic_value */ - double frame_time_seconds; /**< trick_io(s) */ + double frame_time_seconds; /**< trick_io(**) trick_units(s) */ /** Sim_object_id.id (for job identification in timeline logging) */ double frame_id; /**< trick_io(**) */ diff --git a/libexec/trick/sie_concat b/libexec/trick/sie_concat index 29e6817b..afac248e 100755 --- a/libexec/trick/sie_concat +++ b/libexec/trick/sie_concat @@ -1,6 +1,13 @@ #!/usr/bin/perl package sie_concat; +use File::Basename ; +use FindBin qw($RealBin); +use lib "$RealBin/pm" ; +use get_paths ; + +my @trick_python_paths = get_paths( "TRICK_PYTHON_PATH") ; + open(my $S_sie_resource, ">", "./S_sie.resource") or die "cannot open S_sie.resource $!"; print $S_sie_resource "\n\n\n\n"; @@ -14,6 +21,17 @@ while(my $line = <$classes_resource>) { close($classes_resource); +# Add trickified classes.resource if available +foreach my $path ( @trick_python_paths ) { + my $trickified_dir = dirname($path); + if (open(my $classes_resource, "<", "$trickified_dir/build/classes.resource")) { + while(my $line = <$classes_resource>) { + print $S_sie_resource $line; + } + close($classes_resource); + } +} + open(my $top_level_objects_resource, "<", "build/top_level_objects.resource") or die "cannot open build/top_level_objects.resource"; while(my $line = <$top_level_objects_resource>) { diff --git a/trick_source/java/pom.xml b/trick_source/java/pom.xml index 3dbe3092..41e4e090 100644 --- a/trick_source/java/pom.xml +++ b/trick_source/java/pom.xml @@ -43,6 +43,13 @@ dev + + + third-party + file://${basedir}/src/lib/ + + + junit @@ -51,15 +58,9 @@ test - org.jdesktop.bsaf + third-party bsaf 1.9.2 - - - javax.jnlp - jnlp - - org.jfree diff --git a/trick_source/java/src/lib/third-party/bsaf/1.9.2/bsaf-1.9.2.jar b/trick_source/java/src/lib/third-party/bsaf/1.9.2/bsaf-1.9.2.jar new file mode 100644 index 00000000..b0368d3f Binary files /dev/null and b/trick_source/java/src/lib/third-party/bsaf/1.9.2/bsaf-1.9.2.jar differ diff --git a/trick_source/java/src/lib/third-party/bsaf/1.9.2/bsaf-1.9.2.pom b/trick_source/java/src/lib/third-party/bsaf/1.9.2/bsaf-1.9.2.pom new file mode 100644 index 00000000..b6b34503 --- /dev/null +++ b/trick_source/java/src/lib/third-party/bsaf/1.9.2/bsaf-1.9.2.pom @@ -0,0 +1,9 @@ + + + 4.0.0 + third-party + bsaf + 1.9.2 + POM was created from install:install-file + diff --git a/trick_source/java/src/lib/third-party/bsaf/maven-metadata-local.xml b/trick_source/java/src/lib/third-party/bsaf/maven-metadata-local.xml new file mode 100644 index 00000000..f2bad926 --- /dev/null +++ b/trick_source/java/src/lib/third-party/bsaf/maven-metadata-local.xml @@ -0,0 +1,12 @@ + + + third-party + bsaf + + 1.9.2 + + 1.9.2 + + 20240313142443 + + diff --git a/trick_source/sim_services/InputProcessor/IPPython.cpp b/trick_source/sim_services/InputProcessor/IPPython.cpp index ce0b1c28..0ecafeea 100644 --- a/trick_source/sim_services/InputProcessor/IPPython.cpp +++ b/trick_source/sim_services/InputProcessor/IPPython.cpp @@ -12,10 +12,10 @@ #include #include #include -#include #include #include #include +#include #include "trick/IPPython.hh" #include "trick/MemoryManager.hh" @@ -31,6 +31,10 @@ Trick::IPPython::IPPython() : Trick::InputProcessor::InputProcessor() , units_co return ; } + +// Need to save the state of the main thread to allow child threads to run PyRun variants. +static PyThreadState *_save = NULL; + /** @details -# Loops through all of the memorymanager allocations testing if a name handle was given. @@ -62,7 +66,9 @@ void Trick::IPPython::get_TMM_named_variables() { ss << "trick.castAs" << user_type_name << "(int(" << alloc_info->start << "))" << std::endl ; ss << "except AttributeError:" << std::endl ; ss << " pass" << std::endl ; + PyGILState_STATE gstate = PyGILState_Ensure(); PyRun_SimpleString(ss.str().c_str()) ; + PyGILState_Release(gstate); } } } @@ -84,12 +90,6 @@ int Trick::IPPython::init() { FILE *input_fp ; int ret ; std::string error_message ; - pthread_mutexattr_t m_attr ; - - /* Initialize a mutex to protect python processing for var server and events. */ - pthread_mutexattr_init(&m_attr) ; - pthread_mutexattr_settype(&m_attr, PTHREAD_MUTEX_RECURSIVE) ; - pthread_mutex_init(&ip_mutex , &m_attr) ; // Run Py_Initialze first for python 2.x #if PY_VERSION_HEX < 0x03000000 @@ -104,6 +104,7 @@ int Trick::IPPython::init() { Py_Initialize(); #endif + // The following PyRun_ calls do not require the PyGILState guards because no threads are launched /* Import simulation specific routines into interpreter. */ PyRun_SimpleString( "import sys\n" @@ -149,18 +150,21 @@ int Trick::IPPython::init() { } fclose(input_fp) ; - return(0) ; + // Release the GIL from the main thread. + Py_UNBLOCK_THREADS + + return(0) ; } //Command to parse the given string. int Trick::IPPython::parse(std::string in_string) { int ret ; - pthread_mutex_lock(&ip_mutex); in_string += "\n" ; + PyGILState_STATE gstate = PyGILState_Ensure(); ret = PyRun_SimpleString(in_string.c_str()) ; - pthread_mutex_unlock(&ip_mutex); + PyGILState_Release(gstate); return ret ; @@ -181,12 +185,12 @@ int Trick::IPPython::parse(std::string in_string) { */ int Trick::IPPython::parse_condition(std::string in_string, int & cond_return_val ) { - pthread_mutex_lock(&ip_mutex); in_string = std::string("trick_ip.ip.return_val = ") + in_string + "\n" ; // Running the simple string will set return_val. + PyGILState_STATE gstate = PyGILState_Ensure(); int py_ret = PyRun_SimpleString(in_string.c_str()) ; + PyGILState_Release(gstate); cond_return_val = return_val ; - pthread_mutex_unlock(&ip_mutex); return py_ret ; @@ -200,7 +204,10 @@ int Trick::IPPython::restart() { } int Trick::IPPython::shutdown() { + if ( Py_IsInitialized() ) { + // Obtain the GIL so that we can shut down properly + Py_BLOCK_THREADS Py_Finalize(); } return(0) ; diff --git a/trick_source/sim_services/SimObject/JobData.cpp b/trick_source/sim_services/SimObject/JobData.cpp index a248c414..1aaeb45d 100644 --- a/trick_source/sim_services/SimObject/JobData.cpp +++ b/trick_source/sim_services/SimObject/JobData.cpp @@ -66,6 +66,7 @@ Trick::JobData::JobData(int in_thread, int in_id, std::string in_job_class_name next_tics = 0 ; frame_time = 0 ; + frame_time_seconds = 0.0 ; } void Trick::JobData::enable() { diff --git a/trick_source/web/dashboard/package-lock.json b/trick_source/web/dashboard/package-lock.json index c0e9395e..588d8289 100644 --- a/trick_source/web/dashboard/package-lock.json +++ b/trick_source/web/dashboard/package-lock.json @@ -5569,45 +5569,6 @@ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, - "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "dependencies": { - "bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - } - } - }, "bonjour-service": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.1.tgz", @@ -6082,11 +6043,6 @@ "safe-buffer": "~5.1.1" } }, - "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" - }, "cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", @@ -7898,16 +7854,16 @@ } }, "express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -7940,6 +7896,35 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" + }, + "cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==" + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -7953,6 +7938,17 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -8193,9 +8189,9 @@ } }, "follow-redirects": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", - "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==" + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==" }, "font-atlas": { "version": "2.1.0", @@ -14186,24 +14182,6 @@ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" }, - "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "dependencies": { - "bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" - } - } - }, "react": { "version": "16.8.6", "resolved": "https://registry.npmjs.org/react/-/react-16.8.6.tgz", @@ -16887,9 +16865,9 @@ } }, "webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "requires": { "colorette": "^2.0.10", "memfs": "^3.4.3",