… | |
… | |
1618 | always get a readiness notification instantly, and your read (or possibly |
1618 | always get a readiness notification instantly, and your read (or possibly |
1619 | write) will still block on the disk I/O. |
1619 | write) will still block on the disk I/O. |
1620 | |
1620 | |
1621 | Another way to view it is that in the case of sockets, pipes, character |
1621 | Another way to view it is that in the case of sockets, pipes, character |
1622 | devices and so on, there is another party (the sender) that delivers data |
1622 | devices and so on, there is another party (the sender) that delivers data |
1623 | on it's own, but in the case of files, there is no such thing: the disk |
1623 | on its own, but in the case of files, there is no such thing: the disk |
1624 | will not send data on it's own, simply because it doesn't know what you |
1624 | will not send data on its own, simply because it doesn't know what you |
1625 | wish to read - you would first have to request some data. |
1625 | wish to read - you would first have to request some data. |
1626 | |
1626 | |
1627 | Since files are typically not-so-well supported by advanced notification |
1627 | Since files are typically not-so-well supported by advanced notification |
1628 | mechanism, libev tries hard to emulate POSIX behaviour with respect |
1628 | mechanism, libev tries hard to emulate POSIX behaviour with respect |
1629 | to files, even though you should not use it. The reason for this is |
1629 | to files, even though you should not use it. The reason for this is |
… | |
… | |
3504 | exit_main_loop = exit_nested_loop = 1; |
3504 | exit_main_loop = exit_nested_loop = 1; |
3505 | |
3505 | |
3506 | =head2 THREAD LOCKING EXAMPLE |
3506 | =head2 THREAD LOCKING EXAMPLE |
3507 | |
3507 | |
3508 | Here is a fictitious example of how to run an event loop in a different |
3508 | Here is a fictitious example of how to run an event loop in a different |
3509 | thread than where callbacks are being invoked and watchers are |
3509 | thread from where callbacks are being invoked and watchers are |
3510 | created/added/removed. |
3510 | created/added/removed. |
3511 | |
3511 | |
3512 | For a real-world example, see the C<EV::Loop::Async> perl module, |
3512 | For a real-world example, see the C<EV::Loop::Async> perl module, |
3513 | which uses exactly this technique (which is suited for many high-level |
3513 | which uses exactly this technique (which is suited for many high-level |
3514 | languages). |
3514 | languages). |