Cypress技术论坛
直播中

彭亚光

8年用户 222经验值
私信 关注
[问答]

能创建多个线程来进行HTTP POST请求吗?

大家好!
我有一个HTTP POST请求线程,它从队列中弹出,并将其内容发布到服务器。我注意到我的队列很快就满了,我开始丢失要发送的数据包,或者增加了等待时间。增加队列大小对延迟部分不起作用,这取决于发送线程能够处理消息的速度。我能创建多个线程来进行HTTP POST请求吗?这是个好主意还是我应该加快我现有线程的速度?
我的另一个问题是如何停止永远的观察。用0作为函数的一个参数使之进入永远扫描模式,我怎样才能停止它呢?

以上来自于百度翻译


     以下为原文
  Hello All!

I have a http post request thread that pops from a queue and posts its contents to a server. I notice that my queue gets full pretty quickly and I start losing the packets to be sent, or have increased latency. Increasing my queue size will not help with the latency part as that depends on how quickly the send thread is able to process the message. Can I create multiple threads that make the HTTP post request? Is that a good idea or should I look at speeding up my existing thread?
Another question I had is how to disable forever ble_observe. Using 0 as an argument to the function puts it into forever scan mode, how can I stop it?

回帖(1)

徐夕武

2018-10-8 10:28:27
应该考虑加快发送线程和HTTP响应回调线程的处理时间,以便队列填充(PUP)的速率小于队列处理速率(POP)。在发送HTTP请求之后,可以使用WICEDDYRITSGETGETSIMEPHORE(),并在接收到响应后使用WICEDDYRStoStIsSimePurror()。若要禁用BelyValk,可以用第一个参数将函数WICEDEXBTBLYBY()调用为false。

以上来自于百度翻译


     以下为原文
  You should consider speeding up the processing time of the send thread and HTTP response callback thread such that the rate at which the queue is filled up (push) is less than the queue processing rate (pop). You can use wiced_rtos_get_semaphore() after sending the HTTP request and use wiced_rtos_set_semaphore() after receiving the response. To disable ble_observe, you can call the function wiced_bt_ble_observe() with first argument as FALSE.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分