Boost logo

Boost :

From: Scott Zhang (macromarship_at_[hidden])
Date: 2023-12-21 03:30:08


Hello. Thanks for replying.

No. There is no crash, just illegal instruction. And it happens after
the function run over.

After recheck the document,
https://www.boost.org/doc/libs/1_63_0/doc/html/boost_asio/using.html

BOOST_ASIO_DISABLE_THREADS

Explicitly disables Boost.Asio's threading support, independent of
whether or not Boost as a whole supports threads.

I find by -DBOOST_ASIO_DISABLE_THREADS the code works fine.

Still don't know why

On Thu, Dec 21, 2023 at 2:35 AM Ruben Perez <rubenperez038_at_[hidden]> wrote:
>>
>>
>> >
>> > The code looks like below:
>> > void myTask(const char *text)
>> > {
>> > sleep(5);
>> > /*for(;;)
>> > {
>> > //sleep(1);
>> > }*/
>> > cout<<"text is "<<text<<endl;
>> > // cout<<"out"<<endl;
>> > }
>
>
> Does the problem happen if you call any function
> other than sleep? Doing a blocking sleep
> in an async task is something to avoid in general.
> It may be causing interferences with asio's
> internal scheduler.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk