Changeset 213 in flair-src for trunk/lib/FlairCore/src
- Timestamp:
- Jan 30, 2018, 5:47:12 PM (7 years ago)
- Location:
- trunk/lib/FlairCore/src
- Files:
-
- 4 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/FrameworkManager.cpp
r186 r213 167 167 } 168 168 169 void FrameworkManager::SetupLogger(string log_path ) {170 pimpl_->SetupLogger(log_path );169 void FrameworkManager::SetupLogger(string log_path,uint32_t stackSize) { 170 pimpl_->SetupLogger(log_path,stackSize); 171 171 } 172 172 -
trunk/lib/FlairCore/src/FrameworkManager.h
r123 r213 107 107 * 108 108 * \param log_path path to store logs 109 */ 110 void SetupLogger(std::string log_path); 109 * \param stackSize stack size in bytes for logging thread 110 */ 111 void SetupLogger(std::string log_path,uint32_t stackSize=1024*32); 111 112 112 113 /*! -
trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
r186 r213 141 141 void FrameworkManager_impl::ConnectionLost(void) { 142 142 Err("connection lost\n"); 143 gcs_watchdog->SafeStop();143 if(gcs_watchdog!=NULL) gcs_watchdog->SafeStop(); 144 144 connection_lost = true; 145 145 } … … 148 148 // Printf("destruction FrameworkManager_impl\n"); 149 149 int status; 150 char errorMsg[256];151 150 152 151 SafeStop(); … … 162 161 status = DeletePipe(&cmd_pipe); 163 162 if (status != 0) { 163 char errorMsg[256]; 164 164 Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 165 165 } 166 166 status = DeletePipe(&data_pipe); 167 167 if (status != 0) { 168 char errorMsg[256]; 168 169 Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 169 170 } … … 172 173 status = rt_heap_delete(&log_heap); 173 174 if (status != 0) { 175 char errorMsg[256]; 174 176 Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 175 177 } … … 237 239 // watchdog for connection with ground station 238 240 connection_lost = false; 239 gcs_watchdog = new Watchdog( 240 this, std::bind(&FrameworkManager_impl::ConnectionLost, this), 241 watchdogTimeout); 241 gcs_watchdog = new Watchdog(this, std::bind(&FrameworkManager_impl::ConnectionLost, this),watchdogTimeout); 242 242 gcs_watchdog->Start(); 243 243 } … … 340 340 } 341 341 case WATCHDOG_HEADER: { 342 gcs_watchdog->Touch();342 if(gcs_watchdog!=NULL) gcs_watchdog->Touch(); 343 343 break; 344 344 } … … 411 411 Printf("sending %s, size: %i\n", filename.c_str(), size); 412 412 // send file information 413 UDT::sendmsg(file_sock, buf, sizeof(uint8_t) + sizeof(int) + name.size(), -1, 414 true); 413 UDT::sendmsg(file_sock, buf, sizeof(uint8_t) + sizeof(int) + name.size(), -1,true); 415 414 416 415 more_buf = (char *)realloc((void *)buf, size); … … 464 463 } 465 464 466 467 468 465 //wait end ACK 466 int nb_read = UDT::recvmsg(file_sock,&buf,1); 467 if(nb_read<0) { 469 468 Err("UDT::recvmsg error (%s)\n",UDT::getlasterror().getErrorMessage()); 470 469 } else if (nb_read != 1) { 471 470 Err("UDT::recvmsg error, sent %i/%i\n",nb_read,1); 472 471 } 473 472 } 474 473 … … 567 566 #endif 568 567 569 void FrameworkManager_impl::SetupLogger(string log_path) { 570 char errorMsg[256]; 568 void FrameworkManager_impl::SetupLogger(string log_path,uint32_t stackSize) { 571 569 572 570 if (logger_defined == true) { … … 579 577 int status = CreatePipe(&cmd_pipe, "log_cmd"); 580 578 if (status != 0) { 579 char errorMsg[256]; 581 580 Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 582 581 return; … … 585 584 status = CreatePipe(&data_pipe, "log_data"); 586 585 if (status != 0) { 586 char errorMsg[256]; 587 587 Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 588 588 return; … … 592 592 string tmp_name; 593 593 tmp_name = self->ObjectName() + "-log_heap"; 594 status = rt_heap_create(&log_heap, tmp_name.c_str(), LOG_HEAP, H_FIFO);594 status = rt_heap_create(&log_heap, tmp_name.c_str(), RT_LOG_HEAP, H_FIFO); 595 595 if (status != 0) { 596 char errorMsg[256]; 596 597 Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 597 598 return; … … 601 602 continuer = true; 602 603 603 #ifdef NRT_STACK_SIZE604 604 // Initialize thread creation attributes 605 605 pthread_attr_t attr; 606 if (pthread_attr_init(&attr) != 0) { 607 Err("pthread_attr_init error\n"); 608 return; 609 } 610 611 if (pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) { 612 Err("pthread_attr_setstacksize error\n"); 613 return; 614 } 615 616 if (pthread_create(&log_th, &attr, write_log_user, (void *)this) < 0) 617 #else 618 if (pthread_create(&log_th, NULL, write_log_user, (void *)this) < 0) 619 #endif 620 { 621 Err("pthread_create error\n"); 622 return; 623 } 624 #ifdef NRT_STACK_SIZE 625 if (pthread_attr_destroy(&attr) != 0) { 626 Err("pthread_attr_destroy error\n"); 627 return; 628 } 629 #endif 606 status=pthread_attr_init(&attr); 607 if (status != 0) { 608 char errorMsg[256]; 609 Err("pthread_attr_init error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 610 return; 611 } 612 613 status=pthread_attr_setstacksize(&attr, stackSize); 614 if (status != 0) { 615 char errorMsg[256]; 616 Err("pthread_attr_setstacksize error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 617 return; 618 } 619 620 status=pthread_create(&log_th, &attr, write_log_user, (void *)this); 621 if (status < 0) { 622 char errorMsg[256]; 623 Err("pthread_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 624 return; 625 } 626 627 status=pthread_attr_destroy(&attr); 628 if (status != 0) { 629 char errorMsg[256]; 630 Err("pthread_attr_destroy error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 631 return; 632 } 630 633 631 634 logger_defined = true; … … 781 784 int cmd_pipe = -1; 782 785 int data_pipe = -1; 783 string filename;784 786 fd_set set; 785 787 struct timeval timeout; … … 790 792 791 793 #ifdef __XENO__ 792 char errorMsg[256];793 filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd";794 794 while (cmd_pipe < 0) { 795 string filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd"; 795 796 cmd_pipe = open(filename.c_str(), O_RDWR); 796 if (cmd_pipe < 0 && errno != ENOENT) 797 if (cmd_pipe < 0 && errno != ENOENT) { 798 char errorMsg[256]; 797 799 caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg))); 800 } 798 801 usleep(1000); 799 802 } 800 filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_data";801 803 while (data_pipe < 0) { 804 string filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_data"; 802 805 data_pipe = open(filename.c_str(), O_RDWR); 803 if (data_pipe < 0 && errno != ENOENT) 806 if (data_pipe < 0 && errno != ENOENT) { 807 char errorMsg[256]; 804 808 caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg))); 809 } 805 810 usleep(1000); 806 811 } … … 829 834 read(cmd_pipe, &tmp, sizeof(log_desc_t)); 830 835 831 if (tmp.running == true) // start logging 832 { 833 filename = caller->log_path + "/" + caller->FileName(tmp.device) + ".dbt"; 836 if (tmp.running == true) {// start logging 837 string filename = caller->log_path + "/" + caller->FileName(tmp.device) + ".dbt"; 834 838 printf("Creating log file %s (log size %i)\n", filename.c_str(), (int)tmp.size); 835 839 tmp.dbtFile = inithdFile((char *)filename.c_str(), UAV, tmp.size); … … 840 844 xmlSaveFile(filename.c_str(), caller->file_doc); 841 845 } 842 } else // stop logging 843 { 844 //disable watchdog temporarly 845 //this is necessary because GCS is no longer sending the heartbeat when receiving files... 846 //TODO: add a thread in GCS for receiving file 847 //but be careful that with a xbee modem for exemple, sending files can saturate communication and 848 //avoid the heartbeat to be received... so disabling watchdog is not a so bad option... 849 if(caller->gcs_watchdog!=NULL) { 850 caller->gcs_watchdog->SafeStop(); 851 caller->gcs_watchdog->Join(); 852 } 846 } else {// stop logging 847 //disable watchdog temporarly 848 //this is necessary because GCS is no longer sending the heartbeat when receiving files... 849 //TODO: add a thread in GCS for receiving file 850 //but be careful that with a xbee modem for exemple, sending files can saturate communication and 851 //avoid the heartbeat to be received... so disabling watchdog is not a so bad option... 852 if(caller->gcs_watchdog!=NULL) { 853 caller->gcs_watchdog->SafeStop(); 854 caller->gcs_watchdog->Join(); 855 } 853 856 for (size_t i = 0; i < logs.size(); i++) { 854 857 if (logs.at(i).dbtFile != NULL) { 855 858 close_hdfile(logs.at(i).dbtFile); 856 859 857 filename = caller->FileName(logs.at(i).device) + ".dbt";860 string filename = caller->FileName(logs.at(i).device) + ".dbt"; 858 861 caller->SendFile(caller->log_path, filename); 859 862 … … 875 878 876 879 logs.clear(); 877 878 879 880 880 //enable watchdog again 881 if(caller->gcs_watchdog!=NULL) { 882 caller->gcs_watchdog->Start(); 883 } 881 884 } 882 885 } -
trunk/lib/FlairCore/src/Mutex_impl.cpp
r133 r213 51 51 Mutex_impl::~Mutex_impl() { 52 52 int status; 53 char errorMsg[256];54 53 55 54 #ifdef __XENO__ … … 58 57 status = pthread_mutex_destroy(&mutex); 59 58 #endif 60 if (status != 0) 59 if (status != 0) { 60 char errorMsg[256]; 61 61 self->Err("error destroying mutex (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 62 } 62 63 } 63 64 64 65 void Mutex_impl::GetMutex(void) { 65 66 int status; 66 char errorMsg[256];67 67 68 68 #ifdef __XENO__ … … 72 72 status = pthread_mutex_lock(&mutex); 73 73 #endif 74 if (status != 0) 74 if (status != 0) { 75 char errorMsg[256]; 75 76 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 77 } 76 78 } 77 79 -
trunk/lib/FlairCore/src/Semaphore_impl.cpp
r203 r213 28 28 this->self = self; 29 29 int status; 30 char errorMsg[256];31 30 32 31 #ifdef __XENO__ … … 36 35 #endif 37 36 if (status != 0) { 37 char errorMsg[256]; 38 38 self->Err("error creating semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 39 39 } … … 42 42 Semaphore_impl::~Semaphore_impl() { 43 43 int status; 44 char errorMsg[256];45 44 46 45 #ifdef __XENO__ … … 49 48 status = sem_destroy(&semaphore); 50 49 #endif 51 if (status != 0) 50 if (status != 0) { 51 char errorMsg[256]; 52 52 self->Err("error destroying semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 53 } 53 54 } 54 55 -
trunk/lib/FlairCore/src/SharedMem_impl.cpp
r206 r213 29 29 sem(self,1,"/" + name + "_mutex"), sem_producer(self,0,"/" + name + "_producer"),sem_consumer(self,0,"/" + name + "_consumer") { 30 30 31 char errorMsg[256];32 33 31 #ifdef __XENO__ 34 32 heap_binded = false; … … 40 38 } 41 39 if (status != 0) { 40 char errorMsg[256]; 42 41 self->Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 43 42 return; … … 47 46 status = rt_heap_alloc(&heap, 0, TM_NONBLOCK, &ptr); 48 47 if (status != 0) { 48 char errorMsg[256]; 49 49 self->Err("rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 50 50 } … … 68 68 SharedMem_impl::~SharedMem_impl() { 69 69 int status; 70 char errorMsg[256];71 70 72 71 #ifdef __XENO__ … … 75 74 status = rt_heap_delete(&heap); 76 75 if (status != 0) { 76 char errorMsg[256]; 77 77 self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 78 78 } … … 82 82 status = munmap(mem_segment, size); 83 83 if (status != 0) { 84 char errorMsg[256]; 84 85 self->Err("Failed to unmap memory (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 85 86 } … … 87 88 status = close(fd); 88 89 if (status != 0) { 90 char errorMsg[256]; 89 91 self->Err("Failed to close file (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 90 92 } … … 94 96 if(status!=0) 95 97 { 98 char errorMsg[256]; 96 99 self->Err("Failed to unlink memory (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg))); 97 100 } -
trunk/lib/FlairCore/src/TcpSocket.cpp
r15 r213 63 63 64 64 TcpSocket *TcpSocket::Accept(Time timeout) { 65 char errorMsg[256];66 65 TcpSocket *acceptedSocket = nullptr; 67 66 … … 77 76 (timeout == 0) ? nullptr : &tv); // man 2 accept 78 77 if (ret < 0) { 78 char errorMsg[256]; 79 79 Err("select: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg))); 80 80 } else { … … 90 90 if ((acceptedSocket->socket = 91 91 accept(socket, (sockaddr *)&their_addr, &namelen)) < 0) { 92 char errorMsg[256]; 92 93 Err("error: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg))); 93 94 delete acceptedSocket; … … 103 104 const std::string distantAddress, Time timeout) { 104 105 bool success = false; 105 char errorMsg[256];106 106 107 107 if (isConnected) { … … 132 132 if (connect(socket, (sockaddr *)&serv_addr, sizeof(serv_addr)) == -1) { 133 133 if ((errno != EINPROGRESS) && (errno != EAGAIN)) { 134 char errorMsg[256]; 134 135 Err("socket connect: %s\n", 135 136 strerror_r(errno, errorMsg, sizeof(errorMsg))); … … 149 150 (timeout == 0) ? NULL : &tv); // man 2 connect EINPROGRESS 150 151 if (ret < 0) { 152 char errorMsg[256]; 151 153 Err("select: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg))); 152 154 success = false; … … 161 163 socklen_t len = sizeof(error); 162 164 if (getsockopt(socket, SOL_SOCKET, SO_ERROR, &error, &len) != 0) { 163 // Err("getsockopt:164 // %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg)));165 //char errorMsg[256]; 166 // Err("getsockopt: %s\n",strerror_r(errno,errorMsg,sizeof(errorMsg))); 165 167 success = false; 166 168 } else if (error != 0) { 167 // Err("socket error:168 // %d(%s)\n",error,strerror_r(error,errorMsg,sizeof(errorMsg)));169 //char errorMsg[256]; 170 // Err("socket error: %d(%s)\n",error,strerror_r(error,errorMsg,sizeof(errorMsg))); 169 171 success = false; 170 172 } else { -
trunk/lib/FlairCore/src/Thread.cpp
r202 r213 30 30 namespace core { 31 31 32 Thread::Thread(const Object *parent, string name, uint8_t priority )32 Thread::Thread(const Object *parent, string name, uint8_t priority,uint32_t stackSize) 33 33 : Object(parent, name, "Thread") { 34 pimpl_ = new Thread_impl(this, priority );34 pimpl_ = new Thread_impl(this, priority,stackSize); 35 35 } 36 36 -
trunk/lib/FlairCore/src/Thread.h
r212 r213 49 49 */ 50 50 Thread(const Object *parent, std::string name, 51 uint8_t priority,uint32_t stackSize );51 uint8_t priority,uint32_t stackSize=1024*128); 52 52 53 53 /*! -
trunk/lib/FlairCore/src/Thread_impl.cpp
r206 r213 36 36 using namespace flair::core; 37 37 38 Thread_impl::Thread_impl(Thread *self, uint8_t priority ) {38 Thread_impl::Thread_impl(Thread *self, uint8_t priority,uint32_t stackSize) { 39 39 isRunning = false; 40 40 tobestopped = false; 41 41 is_suspended = false; 42 42 period_set = false; 43 this->stackSize = stackSize; 43 44 44 45 this->self = self; … … 78 79 void Thread_impl::Start(void) { 79 80 int status; 80 char errorMsg[256];81 82 81 isRunning = true; 83 82 tobestopped = false; 84 83 is_suspended = false; 85 84 85 Printf("Starting thread %s (priority=%i, stack size=%i bytes)\n",self->ObjectName().c_str(), priority,stackSize); 86 86 #ifdef __XENO__ 87 87 string th_name =TH_NAME; 88 88 89 #ifdef RT_STACK_SIZE 90 status = rt_task_create(&task_rt, th_name.c_str(), RT_STACK_SIZE, 89 status = rt_task_create(&task_rt, th_name.c_str(), stackSize, 91 90 (int)priority, T_JOINABLE); 92 #else 93 status = 94 rt_task_create(&task_rt, th_name.c_str(), 0, (int)priority, T_JOINABLE); 95 #endif // RT_STACK_SIZE 96 if (status != 0) { 91 92 if (status != 0) { 93 char errorMsg[256]; 97 94 self->Err("rt_task_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 98 95 } else { … … 102 99 status = rt_task_start(&task_rt, &main_rt, (void *)this); 103 100 if (status != 0) { 101 char errorMsg[256]; 104 102 self->Err("rt_task_start error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 105 103 } else { … … 115 113 } 116 114 117 #ifdef NRT_STACK_SIZE 118 if (pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) { 115 if (pthread_attr_setstacksize(&attr, stackSize) != 0) { 119 116 self->Err("Error pthread_attr_setstacksize\n"); 120 117 } 121 #endif // NRT_STACK_SIZE122 118 123 119 if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0) { … … 320 316 321 317 void Thread_impl::PrintStats(void) { 318 Printf("Stopping thread %s\n", self->ObjectName().c_str()); 322 319 #ifdef __XENO__ 323 320 RT_TASK_INFO info; … … 333 330 if(last!=0) 334 331 #endif 335 { Printf("Thread::%s :\n", self->ObjectName().c_str());332 { 336 333 if(period_set) {Printf(" period (ns): %lld\n", period);}} 337 334 #ifdef __XENO__ … … 365 362 if (isRunning == true) { 366 363 int status; 367 char errorMsg[256]; 368 364 369 365 #ifdef __XENO__ 370 366 status = rt_task_join(&task_rt); … … 372 368 status = pthread_join(task_nrt, NULL); 373 369 #endif 374 if (status != 0) 370 if (status != 0) { 371 char errorMsg[256]; 375 372 self->Err("error %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 373 } 376 374 isRunning = false; 377 375 } -
trunk/lib/FlairCore/src/UdpSocket_impl.cpp
r178 r213 160 160 ssize_t written; 161 161 string to_send; 162 char errorMsg[256]; 163 162 164 163 if (broadcast == true) { 165 164 to_send = getFrameworkManager()->ObjectName() + ":" + string(src, src_len); … … 173 172 174 173 if (written < 0) { 174 char errorMsg[256]; 175 175 self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg))); 176 176 } else if (written != (ssize_t)src_len) { -
trunk/lib/FlairCore/src/Watchdog.cpp
r15 r213 22 22 Watchdog::Watchdog(const Object *parent, std::function<void()> _expired, 23 23 Time _timer) 24 : Thread(parent, "watchdog", 0 ), expired(_expired), timer(_timer) {}24 : Thread(parent, "watchdog", 0,16384*2), expired(_expired), timer(_timer) {} 25 25 26 26 Watchdog::~Watchdog() { -
trunk/lib/FlairCore/src/Widget_impl.cpp
r133 r213 33 33 namespace { 34 34 #ifdef __XENO__ 35 RT_HEAP xml_heap;36 37 void xml2_free(void *mem) {35 RT_HEAP rt_xml_heap; 36 37 void rt_xml2_free(void *mem) { 38 38 // Printf("free %x\n",mem); 39 39 if (mem == NULL) 40 40 return; 41 int status = rt_heap_free(& xml_heap, mem);41 int status = rt_heap_free(&rt_xml_heap, mem); 42 42 43 43 if (status != 0) { … … 47 47 } 48 48 49 void * xml2_alloc(size_t sz) {49 void *rt_xml2_alloc(size_t sz) { 50 50 void *ptr; 51 51 // printf("alloc %i\n",sz); 52 int status = rt_heap_alloc(& xml_heap, sz, TM_NONBLOCK, &ptr);52 int status = rt_heap_alloc(&rt_xml_heap, sz, TM_NONBLOCK, &ptr); 53 53 if (status != 0) { 54 54 char errorMsg[256]; … … 60 60 } 61 61 62 void * xml2_realloc(void *emem, size_t sz) {62 void *rt_xml2_realloc(void *emem, size_t sz) { 63 63 // Printf("realloc %x %i -> %i\n",emem,sz,sz); 64 64 void *mem_re; 65 65 66 66 if (emem == NULL) { 67 return xml2_alloc(sz);67 return rt_xml2_alloc(sz); 68 68 } else if (sz == 0) { 69 xml2_free(emem);70 } 71 72 mem_re = xml2_alloc(sz);69 rt_xml2_free(emem); 70 } 71 72 mem_re = rt_xml2_alloc(sz); 73 73 74 74 memcpy(mem_re, emem, sz); 75 75 76 xml2_free(emem);76 rt_xml2_free(emem); 77 77 78 78 return mem_re; 79 79 } 80 80 81 char * xml2_strdup(const char *str) {81 char *rt_xml2_strdup(const char *str) { 82 82 // printf("strdup %s\n",str); 83 char *s = (char *) xml2_alloc(strlen(str) + 1);83 char *s = (char *)rt_xml2_alloc(strlen(str) + 1); 84 84 if (s == NULL) 85 85 return NULL; … … 103 103 string tmp_name; 104 104 tmp_name = name + "-xml"; 105 int status = rt_heap_create(& xml_heap, tmp_name.c_str(),XML_HEAP, H_FIFO);105 int status = rt_heap_create(&rt_xml_heap, tmp_name.c_str(), RT_XML_HEAP, H_FIFO); 106 106 if (status != 0) { 107 107 char errorMsg[256]; … … 109 109 } 110 110 111 xmlMemSetup( xml2_free, xml2_alloc, xml2_realloc,xml2_strdup);111 xmlMemSetup(rt_xml2_free, rt_xml2_alloc, rt_xml2_realloc, rt_xml2_strdup); 112 112 #endif //__XENO__ 113 113 } … … 188 188 #ifdef __XENO__ 189 189 int status; 190 char errorMsg[256];191 190 RT_HEAP_INFO info; 192 status = rt_heap_inquire(& xml_heap, &info);191 status = rt_heap_inquire(&rt_xml_heap, &info); 193 192 if (status != 0) { 193 char errorMsg[256]; 194 194 self->Err("rt_heap_inquire error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 195 195 } … … 197 197 self->Err("fuite memoire xml heap (%ld)\n", info.usedmem); 198 198 // Printf("fin heap xml\n"); 199 status = rt_heap_delete(& xml_heap);199 status = rt_heap_delete(&rt_xml_heap); 200 200 if (status != 0) { 201 char errorMsg[256]; 201 202 self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 202 203 } -
trunk/lib/FlairCore/src/ui_com.cpp
r157 r213 40 40 41 41 ui_com::ui_com(const Object *parent, UDTSOCKET sock) 42 : Thread(parent, "send", 2 ) {42 : Thread(parent, "send", 2,16384*2) { 43 43 // buffer envoi 44 44 send_buffer = (char *)malloc(3); -
trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h
r186 r213 46 46 size_t rcv_buf_size); 47 47 void SetupUserInterface(std::string xml_file); 48 void SetupLogger(std::string log_path );48 void SetupLogger(std::string log_path,uint32_t stackSize); 49 49 void AddDeviceToLog(flair::core::IODevice *device); 50 50 bool IsDeviceLogged(const flair::core::IODevice *device) const; -
trunk/lib/FlairCore/src/unexported/Thread_impl.h
r186 r213 32 32 class Thread_impl { 33 33 public: 34 Thread_impl(flair::core::Thread *self, uint8_t priority );34 Thread_impl(flair::core::Thread *self, uint8_t priority,uint32_t stackSize); 35 35 ~Thread_impl(); 36 36 void Start(void); … … 55 55 flair::core::ConditionVariable *cond; 56 56 uint8_t priority; 57 uint32_t stackSize; 57 58 flair::core::Time max_latency, min_latency, mean_latency; 58 59 flair::core::Time last; -
trunk/lib/FlairCore/src/unexported/config.h
r15 r213 20 20 21 21 // stack size of nrt threads, comment it to use default value 22 // only used for user threads in udpsocket and ui_com, in case of the rt library 22 23 #define NRT_STACK_SIZE 1024 * 1024 * 1 23 24 // stack size of rt threads, comment it to use default value25 #define RT_STACK_SIZE 1024 * 10026 24 27 25 // rt pipe size, comment it to use system heap … … 32 30 33 31 // rt log heap size 34 #define LOG_HEAP 1024 * 10032 #define RT_LOG_HEAP 1024 * 100 35 33 36 // xml heap size37 #define XML_HEAP 5 * 1024 * 102434 // rt xml heap size 35 #define RT_XML_HEAP 5 * 1024 * 1024 38 36 39 37 // nrt pipe path
Note:
See TracChangeset
for help on using the changeset viewer.