Is there a sleep() that does a yield internally available in Julia?

126 views
Skip to first unread message

Amit Murthy

unread,
Mar 23, 2013, 12:54:45 PM3/23/13
to julia...@googlegroups.com
The currently available sleep() is just a ccall to usleep(), which would effectively block the entire Julia process.

I am looking for a sleep() that would internally yield to any other running tasks and return after the specified time, so that I can write code like this:

while (event_not done)
     jl_sleep(0.01)    # 10 milliseconds
     event_not done = check_for_event_done()
end

  Amit

Viral Shah

unread,
Mar 24, 2013, 12:01:03 AM3/24/13
to julia...@googlegroups.com
Are you on the latest master? This changed recently.

systemsleep() now calls the unix usleep(), whereas sleep() should yield to other tasks now. Someone should correct me if I am wrong.

-viral

Amit Murthy

unread,
Mar 24, 2013, 12:32:04 AM3/24/13
to julia...@googlegroups.com
Yeah. Sorry, my bad. I was a few days behind on the master.

Thanks.

KDr2

unread,
Mar 24, 2013, 7:17:41 AM3/24/13
to julia...@googlegroups.com
But unfortunately it's broken while running multi Julia processes, I filed an issue(#2663) minutes ago.
--
-- 
Reply all
Reply to author
Forward
0 new messages