Loading ...
Sorry, an error occurred while loading the content.

What..no semaphores?

Expand Messages
  • jatkinsn2003
    First, having just found this site, I m very impressed with the feature set of NuttX. So, kudos! However, I was shocked to not see pthread_sem s located in
    Message 1 of 4 , Jun 3, 2010
    • 0 Attachment
      First, having just found this site, I'm very impressed with the feature set of NuttX. So, kudos!

      However, I was shocked to not see pthread_sem's located in the POSIX api. I have helped implement a POSIX api for one of my client's home-grown RTOS, and we of course don't implement everything, but we do have semaphores. Mainly because of tradition of most people knowing what a semaphore is. Also, there is a fundamental pattern that I've seen used over and over again in embedded systems:

      Interrupt release semaphore to wake up task waiting on semaphore.

      Traditionally, semaphores are great for using in interrupts to wake up those tasks waiting to process some data.

      I know that NuttX's stated goal is not to be completely POSIX compliant, but I'm just flabberghasted that something so fundamental as semaphores were not implemented right away.
    • Gregory N
      ... I m not sure exactly which APIs you feel are missing. NuttX does support POSIX semaphores. Perhaps you are looking in the wrong place? See
      Message 2 of 4 , Jun 3, 2010
      • 0 Attachment
        > However, I was shocked to not see pthread_sem's located in the POSIX api.

        I'm not sure exactly which APIs you feel are missing. NuttX does support POSIX semaphores. Perhaps you are looking in the wrong place?

        See http://nuttx.sourceforge.net/NuttxUserGuide.html#Semaphores

        I am not sure exactly what APIs you might be referring to with pthread_sem, I am not familiar with those. There were no pthread semaphores last time I checked. But POSIX does keep changing.

        I use this (and Linux man pages) for my reference: http://www.opengroup.org/. They don't list any pthread_sem interfaces (http://www.opengroup.org/onlinepubs/007908775/xshix.html).

        > Interrupt release semaphore to wake up task waiting on semaphore.

        Yes, that is a standard way for handling interrupt events in NuttX, you would use the POSIX sem_post in that case: http://nuttx.sourceforge.net/NuttxUserGuide.html#sempost

        You can find lots of driver examples just like that in the drivers/ directory.

        > I know that NuttX's stated goal is not to be completely POSIX compliant, but I'm just flabberghasted that something so fundamental as semaphores were not implemented right away.

        Actually, my goal is to be as POSIX as possible. But on the tiny systems targeted by NuttX, full POSIX compliance just isn't possible or practical in some cases. So NuttX deviates from standards only in small and controlled ways in order to better support small footprint MCUs. The biggest and most obvious is no fork() and exec().

        Greg
      • jatkinsn2003
        ... Chalk it up to bleary eyes after working late too many nights. I looked over again, and found it.:-) I apologize!
        Message 3 of 4 , Jun 3, 2010
        • 0 Attachment
          --- In nuttx@yahoogroups.com, "Gregory N" <spudarnia@...> wrote:
          >
          > > However, I was shocked to not see pthread_sem's located in the POSIX api.
          >
          > I'm not sure exactly which APIs you feel are missing. NuttX does support POSIX semaphores. Perhaps you are looking in the wrong place?
          >

          Chalk it up to bleary eyes after working late too many nights. I looked over again, and found it.:-)

          I apologize!
        • Gregory N
          ... No problem... glad I could clarify. Greg
          Message 4 of 4 , Jun 4, 2010
          • 0 Attachment
            > Chalk it up to bleary eyes after working late too many nights. I looked over again, and found it.:-)

            No problem... glad I could clarify.
            Greg
          Your message has been successfully submitted and would be delivered to recipients shortly.