in reply to RFC: Proposed module POSIX::Yield

Why not just use threads::yield? It typically does the same thing internally (eg on linux it calls sched_yield()), and is portable, eg can be used on windows.

Dave.

Replies are listed 'Best First'.
Re^2: RFC: Proposed module POSIX::Yield
by Joost (Canon) on Dec 02, 2005 at 15:28 UTC
    Well for one, threads::yield will only work on a perl binary with threads support, and AFAIK it's not actually very well defined what threads::yield does, especially in a single-threaded program.

    As for the OP's question about Inline::C vs XS, I'd recommend porting the module to XS if you want to release it to the public, just because it removes a couple of dependencies. Once you have a working Inline::C module, porting to XS isn't very hard.

      Thanks. Do you think it'd be worthwhile doing that? I still like the idea of being able to call sched_yield explicitly (despite dave_the_m's very valid objection), and it'd be useful on older Perl versions as well. But I don't want to pollute CPAN with useless stuff.


      Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan