diff options
| author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-02-21 10:45:42 +0000 | 
|---|---|---|
| committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-02-21 10:45:42 +0000 | 
| commit | 8f89ec3c0bb6f4bc5a77afd37ebb3919181f7a4d (patch) | |
| tree | 73e66c07f6c99ba3d914e1319e7d873ebaa78fbf /os/common/oslib/src/chdynamic.c | |
| parent | adcc51666865020347d364f7b3cad8a622124f7a (diff) | |
| download | ChibiOS-8f89ec3c0bb6f4bc5a77afd37ebb3919181f7a4d.tar.gz ChibiOS-8f89ec3c0bb6f4bc5a77afd37ebb3919181f7a4d.tar.bz2 ChibiOS-8f89ec3c0bb6f4bc5a77afd37ebb3919181f7a4d.zip | |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8919 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/common/oslib/src/chdynamic.c')
| -rw-r--r-- | os/common/oslib/src/chdynamic.c | 39 | 
1 files changed, 24 insertions, 15 deletions
| diff --git a/os/common/oslib/src/chdynamic.c b/os/common/oslib/src/chdynamic.c index 80555a928..3865c318a 100644 --- a/os/common/oslib/src/chdynamic.c +++ b/os/common/oslib/src/chdynamic.c @@ -69,6 +69,7 @@   * @param[in] heapp     heap from which allocate the memory or @p NULL for the
   *                      default heap
   * @param[in] size      size of the working area to be allocated
 + * @param[in] name      thread name
   * @param[in] prio      the priority level for the new thread
   * @param[in] pf        the thread function
   * @param[in] arg       an argument passed to the thread function. It can be
 @@ -80,7 +81,8 @@   * @api
   */
  thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
 -                              tprio_t prio, tfunc_t pf, void *arg) {
 +                              const char *name, tprio_t prio,
 +                              tfunc_t pf, void *arg) {
    void *wsp;
    wsp = chHeapAllocAligned(heapp, size, PORT_WORKING_AREA_ALIGN);
 @@ -88,13 +90,16 @@ thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,      return NULL;
    }
 -#if CH_DBG_FILL_THREADS == TRUE
 -  _thread_memfill((uint8_t *)wsp,
 -                  (uint8_t *)wsp + size,
 -                  CH_DBG_STACK_FILL_VALUE);
 -#endif
 +  thread_descriptor_t td = {
 +    name,
 +    wsp,
 +    (stkalign_t *)((uint8_t *)wsp + size),
 +    prio,
 +    pf,
 +    arg
 +  };
 -  return chThdCreateStatic(wsp, size, prio, pf, arg);
 +  return chThdCreate(&td);
  }
  /**
 @@ -131,6 +136,7 @@ void chThdFreeToHeap(thread_t *tp) {   *          and then release the allocated memory.
   *
   * @param[in] mp        pointer to the memory pool object
 + * @param[in] name      thread name
   * @param[in] prio      the priority level for the new thread
   * @param[in] pf        the thread function
   * @param[in] arg       an argument passed to the thread function. It can be
 @@ -141,8 +147,8 @@ void chThdFreeToHeap(thread_t *tp) {   *
   * @api
   */
 -thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio,
 -                                    tfunc_t pf, void *arg) {
 +thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, const char *name,
 +                                    tprio_t prio, tfunc_t pf, void *arg) {
    void *wsp;
    chDbgCheck(mp != NULL);
 @@ -152,13 +158,16 @@ thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio,      return NULL;
    }
 -#if CH_DBG_FILL_THREADS == TRUE
 -  _thread_memfill((uint8_t *)wsp,
 -                  (uint8_t *)wsp + mp->object_size,
 -                  CH_DBG_STACK_FILL_VALUE);
 -#endif
 +  thread_descriptor_t td = {
 +    name,
 +    wsp,
 +    (stkalign_t *)((uint8_t *)wsp + mp->object_size),
 +    prio,
 +    pf,
 +    arg
 +  };
 -  return chThdCreateStatic(wsp, mp->object_size, prio, pf, arg);
 +  return chThdCreate(&td);
  }
  /**
 | 
