Changeset 213 in flair-src for trunk


Ignore:
Timestamp:
Jan 30, 2018, 5:47:12 PM (4 years ago)
Author:
Sanahuja Guillaume
Message:

thread stack size rework
add Matrix class

Location:
trunk/lib/FlairCore/src
Files:
4 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/FrameworkManager.cpp

    r186 r213  
    167167}
    168168
    169 void FrameworkManager::SetupLogger(string log_path) {
    170   pimpl_->SetupLogger(log_path);
     169void FrameworkManager::SetupLogger(string log_path,uint32_t stackSize) {
     170  pimpl_->SetupLogger(log_path,stackSize);
    171171}
    172172
  • trunk/lib/FlairCore/src/FrameworkManager.h

    r123 r213  
    107107  *
    108108  * \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);
    111112       
    112113        /*!
  • trunk/lib/FlairCore/src/FrameworkManager_impl.cpp

    r186 r213  
    141141void FrameworkManager_impl::ConnectionLost(void) {
    142142  Err("connection lost\n");
    143   gcs_watchdog->SafeStop();
     143  if(gcs_watchdog!=NULL) gcs_watchdog->SafeStop();
    144144  connection_lost = true;
    145145}
     
    148148  // Printf("destruction FrameworkManager_impl\n");
    149149  int status;
    150         char errorMsg[256];
    151150       
    152151  SafeStop();
     
    162161    status = DeletePipe(&cmd_pipe);
    163162    if (status != 0) {
     163      char errorMsg[256];
    164164      Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    165165    }
    166166    status = DeletePipe(&data_pipe);
    167167    if (status != 0) {
     168      char errorMsg[256];
    168169      Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    169170    }
     
    172173    status = rt_heap_delete(&log_heap);
    173174    if (status != 0) {
     175      char errorMsg[256];
    174176      Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    175177    }
     
    237239  // watchdog for connection with ground station
    238240  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);
    242242  gcs_watchdog->Start();
    243243}
     
    340340      }
    341341      case WATCHDOG_HEADER: {
    342         gcs_watchdog->Touch();
     342        if(gcs_watchdog!=NULL) gcs_watchdog->Touch();
    343343        break;
    344344      }
     
    411411  Printf("sending %s, size: %i\n", filename.c_str(), size);
    412412  // 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);
    415414
    416415  more_buf = (char *)realloc((void *)buf, size);
     
    464463  }
    465464
    466     //wait end ACK
    467     int nb_read = UDT::recvmsg(file_sock,&buf,1);
    468     if(nb_read<0) {
     465  //wait end ACK
     466  int nb_read = UDT::recvmsg(file_sock,&buf,1);
     467  if(nb_read<0) {
    469468    Err("UDT::recvmsg error (%s)\n",UDT::getlasterror().getErrorMessage());
    470     } else if (nb_read != 1)  {
     469  } else if (nb_read != 1)  {
    471470    Err("UDT::recvmsg error, sent %i/%i\n",nb_read,1);
    472     }
     471  }
    473472}
    474473
     
    567566#endif
    568567
    569 void FrameworkManager_impl::SetupLogger(string log_path) {
    570   char errorMsg[256];
     568void FrameworkManager_impl::SetupLogger(string log_path,uint32_t stackSize) {
    571569       
    572570        if (logger_defined == true) {
     
    579577  int status = CreatePipe(&cmd_pipe, "log_cmd");
    580578  if (status != 0) {
     579    char errorMsg[256];
    581580    Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    582581    return;
     
    585584  status = CreatePipe(&data_pipe, "log_data");
    586585  if (status != 0) {
     586    char errorMsg[256];
    587587    Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    588588    return;
     
    592592  string tmp_name;
    593593  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);
    595595  if (status != 0) {
     596    char errorMsg[256];
    596597    Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    597598    return;
     
    601602  continuer = true;
    602603
    603 #ifdef NRT_STACK_SIZE
    604604  // Initialize thread creation attributes
    605605  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  }
    630633
    631634  logger_defined = true;
     
    781784  int cmd_pipe = -1;
    782785  int data_pipe = -1;
    783   string filename;
    784786  fd_set set;
    785787  struct timeval timeout;
     
    790792
    791793#ifdef __XENO__
    792         char errorMsg[256];
    793   filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd";
    794794  while (cmd_pipe < 0) {
     795    string filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd";
    795796    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];
    797799      caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg)));
     800    }
    798801    usleep(1000);
    799802  }
    800   filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_data";
    801803  while (data_pipe < 0) {
     804    string filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_data";
    802805    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];
    804808      caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg)));
     809    }
    805810    usleep(1000);
    806811  }
     
    829834        read(cmd_pipe, &tmp, sizeof(log_desc_t));
    830835
    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";
    834838          printf("Creating log file %s (log size %i)\n", filename.c_str(), (int)tmp.size);
    835839          tmp.dbtFile = inithdFile((char *)filename.c_str(), UAV, tmp.size);
     
    840844            xmlSaveFile(filename.c_str(), caller->file_doc);
    841845          }
    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          }
    853856          for (size_t i = 0; i < logs.size(); i++) {
    854857            if (logs.at(i).dbtFile != NULL) {
    855858              close_hdfile(logs.at(i).dbtFile);
    856859
    857               filename = caller->FileName(logs.at(i).device) + ".dbt";
     860              string filename = caller->FileName(logs.at(i).device) + ".dbt";
    858861              caller->SendFile(caller->log_path, filename);
    859862
     
    875878
    876879          logs.clear();
    877             //enable watchdog again
    878             if(caller->gcs_watchdog!=NULL) {
    879                 caller->gcs_watchdog->Start();
    880             }
     880          //enable watchdog again
     881          if(caller->gcs_watchdog!=NULL) {
     882              caller->gcs_watchdog->Start();
     883          }
    881884        }
    882885      }
  • trunk/lib/FlairCore/src/Mutex_impl.cpp

    r133 r213  
    5151Mutex_impl::~Mutex_impl() {
    5252  int status;
    53         char errorMsg[256];
    5453       
    5554#ifdef __XENO__
     
    5857  status = pthread_mutex_destroy(&mutex);
    5958#endif
    60   if (status != 0)
     59  if (status != 0) {
     60    char errorMsg[256];
    6161    self->Err("error destroying mutex (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     62  }
    6263}
    6364
    6465void Mutex_impl::GetMutex(void) {
    6566  int status;
    66         char errorMsg[256];
    6767       
    6868#ifdef __XENO__
     
    7272  status = pthread_mutex_lock(&mutex);
    7373#endif
    74   if (status != 0)
     74  if (status != 0) {
     75    char errorMsg[256];
    7576    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     77  }
    7678}
    7779
  • trunk/lib/FlairCore/src/Semaphore_impl.cpp

    r203 r213  
    2828  this->self = self;
    2929  int status;
    30         char errorMsg[256];
    3130       
    3231#ifdef __XENO__
     
    3635#endif
    3736  if (status != 0) {
     37    char errorMsg[256];
    3838    self->Err("error creating semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    3939  }
     
    4242Semaphore_impl::~Semaphore_impl() {
    4343  int status;
    44         char errorMsg[256];
    4544       
    4645#ifdef __XENO__
     
    4948  status = sem_destroy(&semaphore);
    5049#endif
    51   if (status != 0)
     50  if (status != 0) {
     51    char errorMsg[256];
    5252    self->Err("error destroying semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     53  }
    5354}
    5455
  • trunk/lib/FlairCore/src/SharedMem_impl.cpp

    r206 r213  
    2929                               sem(self,1,"/" + name + "_mutex"), sem_producer(self,0,"/" + name + "_producer"),sem_consumer(self,0,"/" + name + "_consumer") {
    3030
    31   char errorMsg[256];
    32 
    3331#ifdef __XENO__
    3432  heap_binded = false;
     
    4038  }
    4139  if (status != 0) {
     40    char errorMsg[256];
    4241    self->Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    4342    return;
     
    4746  status = rt_heap_alloc(&heap, 0, TM_NONBLOCK, &ptr);
    4847  if (status != 0) {
     48    char errorMsg[256];
    4949    self->Err("rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    5050  }
     
    6868SharedMem_impl::~SharedMem_impl() {
    6969  int status;
    70         char errorMsg[256];
    7170       
    7271#ifdef __XENO__
     
    7574    status = rt_heap_delete(&heap);
    7675    if (status != 0) {
     76      char errorMsg[256];
    7777      self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    7878    }
     
    8282  status = munmap(mem_segment, size);
    8383  if (status != 0) {
     84    char errorMsg[256];
    8485    self->Err("Failed to unmap memory (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    8586  }
     
    8788  status = close(fd);
    8889  if (status != 0) {
     90    char errorMsg[256];
    8991    self->Err("Failed to close file (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    9092  }
     
    9496   if(status!=0)
    9597   {
     98      char errorMsg[256];
    9699       self->Err("Failed to unlink memory (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg)));
    97100   }
  • trunk/lib/FlairCore/src/TcpSocket.cpp

    r15 r213  
    6363
    6464TcpSocket *TcpSocket::Accept(Time timeout) {
    65   char errorMsg[256];
    6665  TcpSocket *acceptedSocket = nullptr;
    6766
     
    7776                   (timeout == 0) ? nullptr : &tv); // man 2 accept
    7877  if (ret < 0) {
     78    char errorMsg[256];
    7979    Err("select: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
    8080  } else {
     
    9090      if ((acceptedSocket->socket =
    9191               accept(socket, (sockaddr *)&their_addr, &namelen)) < 0) {
     92        char errorMsg[256];
    9293        Err("error: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
    9394        delete acceptedSocket;
     
    103104                        const std::string distantAddress, Time timeout) {
    104105  bool success = false;
    105   char errorMsg[256];
    106106
    107107  if (isConnected) {
     
    132132  if (connect(socket, (sockaddr *)&serv_addr, sizeof(serv_addr)) == -1) {
    133133    if ((errno != EINPROGRESS) && (errno != EAGAIN)) {
     134      char errorMsg[256];
    134135      Err("socket connect: %s\n",
    135136          strerror_r(errno, errorMsg, sizeof(errorMsg)));
     
    149150                 (timeout == 0) ? NULL : &tv); // man 2 connect EINPROGRESS
    150151      if (ret < 0) {
     152        char errorMsg[256];
    151153        Err("select: %s\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
    152154        success = false;
     
    161163          socklen_t len = sizeof(error);
    162164          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)));
    165167            success = false;
    166168          } 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)));
    169171            success = false;
    170172          } else {
  • trunk/lib/FlairCore/src/Thread.cpp

    r202 r213  
    3030namespace core {
    3131
    32 Thread::Thread(const Object *parent, string name, uint8_t priority)
     32Thread::Thread(const Object *parent, string name, uint8_t priority,uint32_t stackSize)
    3333    : Object(parent, name, "Thread") {
    34   pimpl_ = new Thread_impl(this, priority);
     34  pimpl_ = new Thread_impl(this, priority,stackSize);
    3535}
    3636
  • trunk/lib/FlairCore/src/Thread.h

    r212 r213  
    4949  */
    5050  Thread(const Object *parent, std::string name,
    51          uint8_t priority,uint32_t stackSize);
     51         uint8_t priority,uint32_t stackSize=1024*128);
    5252
    5353  /*!
  • trunk/lib/FlairCore/src/Thread_impl.cpp

    r206 r213  
    3636using namespace flair::core;
    3737
    38 Thread_impl::Thread_impl(Thread *self, uint8_t priority) {
     38Thread_impl::Thread_impl(Thread *self, uint8_t priority,uint32_t stackSize) {
    3939  isRunning = false;
    4040  tobestopped = false;
    4141  is_suspended = false;
    4242  period_set = false;
     43  this->stackSize = stackSize;
    4344
    4445  this->self = self;
     
    7879void Thread_impl::Start(void) {
    7980  int status;
    80         char errorMsg[256];
    81 
    8281  isRunning = true;
    8382  tobestopped = false;
    8483  is_suspended = false;
    8584
     85 Printf("Starting thread %s (priority=%i, stack size=%i bytes)\n",self->ObjectName().c_str(), priority,stackSize);
    8686#ifdef __XENO__
    8787  string th_name =TH_NAME;
    8888
    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,
    9190                          (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];
    9794    self->Err("rt_task_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    9895  } else {
     
    10299  status = rt_task_start(&task_rt, &main_rt, (void *)this);
    103100  if (status != 0) {
     101    char errorMsg[256];
    104102    self->Err("rt_task_start error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    105103  } else {
     
    115113  }
    116114
    117 #ifdef NRT_STACK_SIZE
    118   if (pthread_attr_setstacksize(&attr, NRT_STACK_SIZE) != 0) {
     115  if (pthread_attr_setstacksize(&attr, stackSize) != 0) {
    119116    self->Err("Error pthread_attr_setstacksize\n");
    120117  }
    121 #endif // NRT_STACK_SIZE
    122118
    123119  if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0) {
     
    320316
    321317void Thread_impl::PrintStats(void) {
     318  Printf("Stopping thread %s\n", self->ObjectName().c_str());
    322319#ifdef __XENO__
    323320  RT_TASK_INFO info;
     
    333330  if(last!=0)
    334331#endif
    335     { Printf("Thread::%s :\n", self->ObjectName().c_str());
     332    {
    336333    if(period_set) {Printf("    period (ns): %lld\n", period);}}
    337334#ifdef __XENO__
     
    365362  if (isRunning == true) {
    366363    int status;
    367                 char errorMsg[256];
    368 
     364 
    369365#ifdef __XENO__
    370366    status = rt_task_join(&task_rt);
     
    372368    status = pthread_join(task_nrt, NULL);
    373369#endif
    374     if (status != 0)
     370    if (status != 0) {
     371      char errorMsg[256];
    375372      self->Err("error %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     373    }
    376374    isRunning = false;
    377375  }
  • trunk/lib/FlairCore/src/UdpSocket_impl.cpp

    r178 r213  
    160160  ssize_t written;
    161161  string to_send;
    162         char errorMsg[256];
    163 
     162       
    164163  if (broadcast == true) {
    165164    to_send = getFrameworkManager()->ObjectName() + ":" + string(src, src_len);
     
    173172
    174173  if (written < 0) {
     174    char errorMsg[256];
    175175    self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
    176176  } else if (written != (ssize_t)src_len) {
  • trunk/lib/FlairCore/src/Watchdog.cpp

    r15 r213  
    2222Watchdog::Watchdog(const Object *parent, std::function<void()> _expired,
    2323                   Time _timer)
    24     : Thread(parent, "watchdog", 0), expired(_expired), timer(_timer) {}
     24    : Thread(parent, "watchdog", 0,16384*2), expired(_expired), timer(_timer) {}
    2525
    2626Watchdog::~Watchdog() {
  • trunk/lib/FlairCore/src/Widget_impl.cpp

    r133 r213  
    3333namespace {
    3434#ifdef __XENO__
    35 RT_HEAP xml_heap;
    36 
    37 void xml2_free(void *mem) {
     35RT_HEAP rt_xml_heap;
     36
     37void rt_xml2_free(void *mem) {
    3838  // Printf("free %x\n",mem);
    3939  if (mem == NULL)
    4040    return;
    41   int status = rt_heap_free(&xml_heap, mem);
     41  int status = rt_heap_free(&rt_xml_heap, mem);
    4242
    4343  if (status != 0) {
     
    4747}
    4848
    49 void *xml2_alloc(size_t sz) {
     49void *rt_xml2_alloc(size_t sz) {
    5050  void *ptr;
    5151  // 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);
    5353  if (status != 0) {
    5454                char errorMsg[256];
     
    6060}
    6161
    62 void *xml2_realloc(void *emem, size_t sz) {
     62void *rt_xml2_realloc(void *emem, size_t sz) {
    6363  // Printf("realloc %x %i -> %i\n",emem,sz,sz);
    6464  void *mem_re;
    6565
    6666  if (emem == NULL) {
    67     return xml2_alloc(sz);
     67    return rt_xml2_alloc(sz);
    6868  } 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);
    7373
    7474  memcpy(mem_re, emem, sz);
    7575
    76   xml2_free(emem);
     76  rt_xml2_free(emem);
    7777
    7878  return mem_re;
    7979}
    8080
    81 char *xml2_strdup(const char *str) {
     81char *rt_xml2_strdup(const char *str) {
    8282  // printf("strdup %s\n",str);
    83   char *s = (char *)xml2_alloc(strlen(str) + 1);
     83  char *s = (char *)rt_xml2_alloc(strlen(str) + 1);
    8484  if (s == NULL)
    8585    return NULL;
     
    103103    string tmp_name;
    104104    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);
    106106    if (status != 0) {
    107107                        char errorMsg[256];
     
    109109    }
    110110
    111     xmlMemSetup(xml2_free, xml2_alloc, xml2_realloc, xml2_strdup);
     111    xmlMemSetup(rt_xml2_free, rt_xml2_alloc, rt_xml2_realloc, rt_xml2_strdup);
    112112#endif //__XENO__
    113113  }
     
    188188#ifdef __XENO__
    189189    int status;
    190                 char errorMsg[256];
    191190    RT_HEAP_INFO info;
    192     status = rt_heap_inquire(&xml_heap, &info);
     191    status = rt_heap_inquire(&rt_xml_heap, &info);
    193192    if (status != 0) {
     193      char errorMsg[256];
    194194      self->Err("rt_heap_inquire error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    195195    }
     
    197197      self->Err("fuite memoire xml heap (%ld)\n", info.usedmem);
    198198    // Printf("fin heap xml\n");
    199     status = rt_heap_delete(&xml_heap);
     199    status = rt_heap_delete(&rt_xml_heap);
    200200    if (status != 0) {
     201      char errorMsg[256];
    201202      self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    202203    }
  • trunk/lib/FlairCore/src/ui_com.cpp

    r157 r213  
    4040
    4141ui_com::ui_com(const Object *parent, UDTSOCKET sock)
    42     : Thread(parent, "send", 2) {
     42    : Thread(parent, "send", 2,16384*2) {
    4343  // buffer envoi
    4444  send_buffer = (char *)malloc(3);
  • trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h

    r186 r213  
    4646                       size_t rcv_buf_size);
    4747  void SetupUserInterface(std::string xml_file);
    48   void SetupLogger(std::string log_path);
     48  void SetupLogger(std::string log_path,uint32_t stackSize);
    4949  void AddDeviceToLog(flair::core::IODevice *device);
    5050        bool IsDeviceLogged(const flair::core::IODevice *device) const;
  • trunk/lib/FlairCore/src/unexported/Thread_impl.h

    r186 r213  
    3232class Thread_impl {
    3333public:
    34   Thread_impl(flair::core::Thread *self, uint8_t priority);
     34  Thread_impl(flair::core::Thread *self, uint8_t priority,uint32_t stackSize);
    3535  ~Thread_impl();
    3636  void Start(void);
     
    5555  flair::core::ConditionVariable *cond;
    5656  uint8_t priority;
     57  uint32_t stackSize;
    5758  flair::core::Time max_latency, min_latency, mean_latency;
    5859  flair::core::Time last;
  • trunk/lib/FlairCore/src/unexported/config.h

    r15 r213  
    2020
    2121// 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
    2223#define NRT_STACK_SIZE 1024 * 1024 * 1
    23 
    24 // stack size of rt threads, comment it to use default value
    25 #define RT_STACK_SIZE 1024 * 100
    2624
    2725// rt pipe size, comment it to use system heap
     
    3230
    3331// rt log heap size
    34 #define LOG_HEAP 1024 * 100
     32#define RT_LOG_HEAP 1024 * 100
    3533
    36 // xml heap size
    37 #define XML_HEAP 5 * 1024 * 1024
     34// rt xml heap size
     35#define RT_XML_HEAP 5 * 1024 * 1024
    3836
    3937// nrt pipe path
Note: See TracChangeset for help on using the changeset viewer.