1 | /* |
1 | /* |
2 | * libev solaris event port backend |
2 | * libev solaris event port backend |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
83 | { |
83 | { |
84 | int res, i; |
84 | int res, i; |
85 | struct timespec ts; |
85 | struct timespec ts; |
86 | uint_t nget = 1; |
86 | uint_t nget = 1; |
87 | |
87 | |
88 | if (expect_false (suspend_cb)) suspend_cb (EV_A); |
88 | EV_RELEASE_CB; |
89 | ts.tv_sec = (time_t)timeout; |
89 | ts.tv_sec = (time_t)timeout; |
90 | ts.tv_nsec = (long)(timeout - (ev_tstamp)ts.tv_sec) * 1e9; |
90 | ts.tv_nsec = (long)(timeout - (ev_tstamp)ts.tv_sec) * 1e9; |
91 | res = port_getn (backend_fd, port_events, port_eventmax, &nget, &ts); |
91 | res = port_getn (backend_fd, port_events, port_eventmax, &nget, &ts); |
92 | if (expect_false (resume_cb)) resume_cb (EV_A); |
92 | EV_ACQUIRE_CB; |
93 | |
93 | |
94 | if (res == -1) |
94 | if (res == -1) |
95 | { |
95 | { |
96 | if (errno != EINTR && errno != ETIME) |
96 | if (errno != EINTR && errno != ETIME) |
97 | ev_syserr ("(libev) port_getn"); |
97 | ev_syserr ("(libev) port_getn"); |