This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

wait_for_fds_ready() causing code to get stuck

So I am initializing the FDS but the program I guess stands in an infinite loop at wait_for_fds_ready():

This is not working. At the moment I have given a delay of 300ms and then do the rest of the initialization but I feel the process is not safe enough.

Let me  know if further information is required.

Parents
  • Hi,

    Which SDK version are you using? Have you remembered to register an event handler before you call the fds_init() function?

    regards

    Jared

  • I am using SDK 15.3. No I did not register the event handler yet, is that necessary?

  • Also Jared should I use wait_for_fds_ready() after performing each write? And what about read?

  • Y̶e̶s̶,̶ ̶o̶t̶h̶e̶r̶w̶i̶s̶e̶ ̶t̶h̶e̶ ̶a̶p̶p̶l̶i̶c̶a̶t̶i̶o̶n̶ ̶w̶o̶n̶'̶t̶ ̶b̶e̶ ̶n̶o̶t̶i̶f̶i̶e̶d̶ ̶t̶h̶a̶t̶ ̶t̶h̶e̶ ̶i̶n̶i̶t̶i̶a̶l̶i̶z̶a̶t̶i̶o̶n̶ ̶h̶a̶s̶ ̶b̶e̶e̶n̶ ̶f̶i̶n̶i̶s̶h̶e̶d̶.̶

    See reply over.

  • Apart from notification, does it also mean that the process might not have been completed?

Reply Children
  • Hi,

    Sorry for the misunderstanding, I read the question a bit too fast and thought you were asking about the registration of the handler. 

    Ameer Usman said:
    should I use wait_for_fds_ready() after performing each write?

     The FDS module is asynchronous which mean that each operations is not performed immediately on a return but rather scheduled in a queue.The event handler will generate a WRITE event when the write event has been performed successfully. I suggest that you check that the operation is performed by waiting for the event in the handler instead of using wait_for_fds_ready().

    regards

    Jared