Closed liexusong closed 10 years ago
True. Thanks for raising the issue. What were you attempting to do with lthread_sleep(0) ?
When I read the source codes and found it, may be solved this problem by codes:
void
lthread_sleep(uint64_t msecs)
{
struct lthread *lt = lthread_get_sched()->current_lthread;
if (msecs <= 0) {
return;
}
_lthread_sched_sleep(lt, msecs);
}
Any preferred api to yield current coroutine?
lthread_sleep(1);
What's the reason behind the yield?
thread ring benchmark, I'm evaluate the performance.
lthread_sleep(1) will hurt it.
if (msecs == 0) { just put it into running list and switch would be good. }
Any arm support plan? the program I write will used x64 and arm in linux. Your lthread is the most well written and maintained one.
Ah perf bench.
Sure, won't hurt putting it in the running list.
While I don't have plans to support ARM, I don't mind supporting it. Will give it a shot on the weekend.
thanks, that's great.
from bench, threadring is more quick than libtask.
Fixed. lthread_sleep(0) causes the lthread to yield only.
@JunfengJia can you try this fork for arm? https://github.com/jannson/lthread
I have just support it for some days and test ok. But I want more to test it.
May be exists bug when call function lthread_sleep(0), because current CPU context was lose.