[SOLVED] MemCpy reentrant in different tasks

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] MemCpy reentrant in different tasks

    Dear all,

    We divided a piece of ram memory into blocks for reading and writing parameters of several specific tasks. Every task has his block of memory for its parameters.
    Is it possible when using Embos that a 'memcp' mess up the data inside a memory block of a task because of interrupting memcpy from one task by another task? Is 'memcpy' reentrant?

    Thanks for your support.

    Br, Peter
  • Dear Peter,

    memcpy() is not part of embOS but is provided by the used C standard library implementation.

    Which compiler or C standard library implementation are you using?

    If memcpy() should not be thread-safe or reentrant for your C standard library:
    Our embOS ports usually support thread-safety if the used compiler and standard library provide the possibility to implement thread-safety.
    For further information, please take a look into the chapter "CPU and compiler specifics" of the port specific embOS manual.

    Best regards,
    Michael Mleczko
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • With Embedded Studio, memcpy() is reentrant and thus does not need any further handling to make it thread-safe.
    However, if the same memory block is used by multiple tasks, operations on this memory block should still be guarded by mutexes, semaphores or readers-writer locks.

    Does this answer your questions?

    Please let me know if I can be of any further help.

    Best regards,
    Michael Mleczko
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.