Oh~, I have assumed you try to fix it.

BTW, replacing polling is definitely required.

 

BR, Uze Choi

From: iotivity-dev@lists.iotivity.org [mailto:iotivity-dev@lists.iotivity.org] 
On Behalf Of Ravee
Sent: Wednesday, November 28, 2018 2:25 PM
To: uzc...@samsung.com
Cc: iotivity-dev@lists.iotivity.org
Subject: Re: [dev] Thread wake up every 10ms

 

Are we planning to get this change to mainline?

 

On Tue, Nov 27, 2018 at 8:15 AM 최우제 (Uze Choi) <uzc...@samsung.com> wrote:

Sorry, Let me abort point 2 below, only single execution is guaranteed from the 
code.

2.There are two points calling OCProcess() periodically which is 
InProcServerWrapper::processFunc() and InProcClientWrapper::listeningFunc().

   Two entities will receive the signal and race to execute the OCProcess() and 
they are locked with recursive mutex. This may need another structure change.

 

BR, Uze Choi

From: iotivity-dev@lists.iotivity.org [mailto:iotivity-dev@lists.iotivity.org] 
On Behalf Of ÃÖ¿ìÁ¦ (Uze Choi)
Sent: Tuesday, November 27, 2018 10:58 AM
To: 'Ravee'; iotivity-dev@lists.iotivity.org
Subject: Re: [dev] Thread wake up every 10ms

 

Apply Wait and signal awake is my suggestion.

Before wait, it need to check the receive queue and awake from wait when 
received message happen.

 

But there three point to consider.

1. From OCProcess some internal call exists which requires timeout check. This 
mean OCProcess should be called after each timeout happens.

This may requires timeout management logic as like IoTivty-Lite with returning 
remaining timeout period from OCProcess().

2.There are two points calling OCProcess() periodically which is 
InProcServerWrapper::processFunc() and InProcClientWrapper::listeningFunc().

   Two entities will receive the signal and race to execute the OCProcess() and 
they are locked with recursive mutex. This may need another structure change.

3. OCProcess() and other OC API call are synchronized with recursive mutex. I 
don¡¯t know detail if this may requires additional consideration.

 

    ts = OCProcess();
    pthread_mutex_lock(&mutex);

if (is_queue_empty()) {
   if (ts) {
      pthread_cond_wait(&cv, &mutex);
    } else {
      pthread_cond_timedwait(&cv, &mutex, &ts);
    }

}

 

BR, Uze Choi

From: iotivity-dev@lists.iotivity.org [mailto:iotivity-dev@lists.iotivity.org] 
On Behalf Of Ravee
Sent: Friday, November 23, 2018 11:04 PM
To: iotivity-dev@lists.iotivity.org
Subject: Re: [dev] Thread wake up every 10ms

 

Any suggestions, or patches to try async mechanism instead of polling?

 

On Fri, Nov 23, 2018 at 5:37 PM Raveendranath Kondrakunta 
<raveendranath.kondraku...@gmail.com> wrote:

Hi,

 

I found a function where the thread wakes up every 10ms, On IoT devices, we 
except to save power, however this function is waking up every 10ms and 
defeating the purpose. We need to relook at the design here.

 

    void InProcServerWrapper::processFunc()

    {

        auto cLock = m_csdkLock.lock();

        while(cLock && m_threadRun)

        {

            OCStackResult result;

 

            {

                std::lock_guard<std::recursive_mutex> lock(*cLock);

                result = OCProcess();

            }

 

            if(OC_STACK_ERROR == result)

            {

                oclog() << "OCProcess failed with result " << result 
<<std::flush;

                // ...the value of variable result is simply ignored for now.

            }

 

            std::this_thread::sleep_for(std::chrono::milliseconds(10));

        }

    }

-Ravee

 

  
<http://ext.samsung.net/mail/ext/v1/external/status/update?userid=uzchoi&do=bWFpbElEPTIwMTgxMTI3MDE1ODEzZXBjYXMxcDRkYmRiNWE0ZDk0NWIyZDcwY2Q0ZjNlYmVhNTAyYmFkMCZyZWNpcGllbnRBZGRyZXNzPWlvdGl2aXR5LWRldkBsaXN0cy5pb3Rpdml0eS5vcmc_>
 


 

 


 

  
<http://ext.samsung.net/mail/ext/v1/external/status/update?userid=uzchoi&do=bWFpbElEPTIwMTgxMTI3MDI0NTE3ZXBjYXMxcDRkZTNlNjFkNmNmMzhiNzVmNzI3NDljOTE3ZGZkM2YyZiZyZWNpcGllbnRBZGRyZXNzPXJhdmVlbmRyYW5hdGgua29uZHJha3VudGFAZ21haWwuY29t>
 




-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10030): 
https://lists.iotivity.org/g/iotivity-dev/message/10030
Mute This Topic: https://lists.iotivity.org/mt/28292450/21656
Group Owner: iotivity-dev+ow...@lists.iotivity.org
Unsubscribe: https://lists.iotivity.org/g/iotivity-dev/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to