y_socket: transfert kill to extern, y_nnn: debug leak mem
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
|
||||
@@ -35,22 +35,38 @@ void y_nnn_manager_handle_input(char * buf, int len_buf, void *arg){
|
||||
launch_sleep_wait_bash(bash_arg);
|
||||
}else if(strncmp(buf,"killbash",8)==0){
|
||||
kill_all_bash(bash_arg);
|
||||
}else if(strncmp(buf,"stoplearn",9)==0){
|
||||
}else if((strncmp(buf,"kill",4)==0) || (strncmp(buf,"stoplearn",9)==0)){
|
||||
kill_all_bash(bash_arg);
|
||||
pthread_mutex_lock(rlAgent->status->mut_ending);
|
||||
rlAgent->status->ending=1;
|
||||
pthread_mutex_unlock(rlAgent->status->mut_ending);
|
||||
|
||||
kill_all_bash(bash_arg);
|
||||
}else if(strncmp(buf,"startprintnewbash",17)==0){
|
||||
}else if(strncmp(buf,"stopprint",9)==0){
|
||||
pthread_mutex_lock(bash_arg->mut_bash_var);
|
||||
bash_arg->go_on=0;
|
||||
pthread_mutex_unlock(bash_arg->mut_bash_var);
|
||||
if(bash_arg->thread_run_newbash)
|
||||
pthread_join(*(bash_arg->thread_run_newbash),NULL);
|
||||
if(bash_arg->thread_run_waitbash)
|
||||
pthread_join(*(bash_arg->thread_run_waitbash),NULL);
|
||||
|
||||
|
||||
}else if(strncmp(buf,"goonprint",9)==0){
|
||||
pthread_mutex_lock(bash_arg->mut_bash_var);
|
||||
bash_arg->go_on=1;
|
||||
pthread_mutex_unlock(bash_arg->mut_bash_var);
|
||||
}else if(strncmp(buf,"startprintnewbash",17)==0){
|
||||
run_newbash(bash_arg);
|
||||
bash_arg->thread_run_newbash=malloc(sizeof(pthread_t));
|
||||
if(bash_arg->thread_run_newbash==NULL)
|
||||
bash_arg->thread_run_newbash=malloc(sizeof(pthread_t));
|
||||
pthread_create(bash_arg->thread_run_newbash, NULL, runBashPrint, arg);
|
||||
//pthread_t thread_run;
|
||||
//pthread_create(&thread_run, NULL, runBashPrint, arg);
|
||||
//Sleep(2);
|
||||
|
||||
}else if(strncmp(buf,"startprintwaitbash",18)==0){
|
||||
bash_arg->thread_run_waitbash=malloc(sizeof(pthread_t));
|
||||
if(bash_arg->thread_run_waitbash==NULL)
|
||||
bash_arg->thread_run_waitbash=malloc(sizeof(pthread_t));
|
||||
pthread_create(bash_arg->thread_run_waitbash, NULL, run_sleep_wait_bash_and_print, arg);
|
||||
//pthread_t thread_run;
|
||||
//pthread_create(&thread_run, NULL, run_sleep_wait_bash_and_print, arg);
|
||||
@@ -103,7 +119,7 @@ void* runBashPrint(void *arg){
|
||||
wait_valid_pid_bash(bash_arg);
|
||||
|
||||
printf("debug: start runBashPrint in episode: %ld\n",qlStatus->index_episode);
|
||||
while((new_bash_exist(bash_arg)) && check_go_on_print_params(pprint) && !is_ending(qlStatus)){
|
||||
while( check_go_on_bash(bash_arg) && (new_bash_exist(bash_arg)) && check_go_on_print_params(pprint) && !is_ending(qlStatus)){
|
||||
if(/*(qlStatus->nb_episodes %125 == 0) &&*/ pprint->printed){
|
||||
//pthread_mutex_lock(&(pprint->mut_printed));
|
||||
pthread_mutex_lock(&(car->mut_coord));
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
GEN_LIST_ALL(pid_t)
|
||||
|
||||
|
||||
/* return max pidof target, and if m_pid_t is not NULL, put into it all pids */
|
||||
/* return last modified pidof target, and if m_pid_t is not NULL, put into it all pids */
|
||||
pid_t pidof(char *target, struct main_list_pid_t *m_pid_t){
|
||||
pid_t maxpid=0;
|
||||
pid_t lastModifiedPid=0;
|
||||
ssize_t refModified=0;
|
||||
struct dirent *entry;
|
||||
DIR *proc = opendir("/proc"); /* */
|
||||
|
||||
@@ -41,7 +42,13 @@ pid_t pidof(char *target, struct main_list_pid_t *m_pid_t){
|
||||
name[status-1]=0;
|
||||
if(strcmp(name,target)==0){
|
||||
pid_t valpid=(pid_t)atol(entry->d_name);
|
||||
if(maxpid<valpid) maxpid=valpid;
|
||||
struct stat attr;
|
||||
stat(path, &attr);
|
||||
ssize_t modifPathDate = attr.st_mtime;
|
||||
if(refModified<modifPathDate) {
|
||||
lastModifiedPid=valpid;
|
||||
refModified=modifPathDate;
|
||||
}
|
||||
if(m_pid_t){
|
||||
push_back_list_pid_t(m_pid_t,valpid);
|
||||
}
|
||||
@@ -51,7 +58,7 @@ pid_t pidof(char *target, struct main_list_pid_t *m_pid_t){
|
||||
}
|
||||
closedir(proc);
|
||||
|
||||
return maxpid;
|
||||
return lastModifiedPid;
|
||||
}
|
||||
/* to write in an open bash terminal */
|
||||
int sprintbashpid(pid_t pid, char *content, size_t size_content){
|
||||
|
||||
@@ -347,8 +347,8 @@ EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weigh
|
||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20240717_01h42m16s_5300.txt");
|
||||
*/
|
||||
|
||||
//EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20240717_09h11m09s_1700.txt");
|
||||
//EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20240717_09h11m09s_1700.txt");
|
||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_.symlink");
|
||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_.symlink");
|
||||
|
||||
struct status_qlearning *qlstatus = create_status_qlearning ();
|
||||
struct delay_params *dly = create_delay_params (
|
||||
|
||||
Reference in New Issue
Block a user