OS Locks

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

  • Dear Segger,



    The OS interface of embFile requires me to provide an implementation of several functions for providing lock synchronization. In my setup the function FS_X_OS_Init(unsigned NumLocks) is always called with NumLocks = 0. Changing the value of FS_OS_LOCKING does not have any effect on this. Also, the comments associated with the function states that "FS_NUM_LOCKS" number of binary semaphores/mutexes should be initialized and reserved for embFile. The symbol "FS_NUM_LOCKS", however, is not known to my compiler and I have not been able to locate it in the source.



    I should point out that synchronization seems to work fine but I need to "guess" the number of locks needed or allocate them as needed. Neither of those approaches is really satiafactory for our purpose.



    Thank you for a very nice and easy to use product,

    Peter




  • Hi Peter,

    the comment in the OS layer template is incorrect.
    The value of NumLocks is calculated automatically.

    It depends on the compile time switch FS_OS_LOCKING:

    If it is not defined, NumLocks is 0
    If it is defined to 0, NumLocks is 0
    If it is defined to 1, NumLocks is 1
    If it is defined to 2, NumLocks is 1 + number of drivers which are added in FS_X_AddDevices()

    We will correct this in the template.


    Best regards
    Alex
    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.