[jdk17u-dev] RFR: 8312065: Socket.connect does not timeout when profiling [v4]

Vyom Tewari vtewari at openjdk.org
Fri Sep 8 08:55:55 UTC 2023


On Fri, 8 Sep 2023 06:24:52 GMT, Long Yang <duke at openjdk.org> wrote:

>> src/java.base/aix/native/libnet/aix_close.c line 502:
>> 
>>> 500:     ret = poll(ufds, nfds, timeout);
>>> 501:     endOp(fdEntry, &self);
>>> 502:     return ret;
>> 
>> with this approach we have lot of duplicate code what if we reuse most of the duplicate code as follows ?
>> 
>> #define BLOCKING_IO_RETURN_INT(FD, FUNC) {      \
>>     int ret;                                    \
>>     do {                                        \
>>         ret = NONBLOCKING_IO_RETURN_INT(FD, FUNC); \
>>     } while (ret == -1 && errno == EINTR);      \
>>     return ret;                                 \
>> }
>> 
>> #define NONBLOCKING_IO_RETURN_INT(FD, FUNC) {   \
>>     int ret;                                    \
>>     threadEntry_t self;                         \
>>     fdEntry_t *fdEntry = getFdEntry(FD);        \
>>     if (fdEntry == NULL) {                      \
>>         errno = EBADF;                          \
>>         return -1;                              \
>>     }                                           \
>>     startOp(fdEntry, &self);                    \
>>     ret = FUNC;                                 \
>>     endOp(fdEntry, &self);                      \
>>     return ret;                                 \
>> }
>
> hi, vyommani, thanks for the suggestion. Do you mind if I modify it like Paul did, I feel like this would make the macro cleaner.

yes, that's more cleaner approach.

-------------

PR Review Comment: https://git.openjdk.org/jdk17u-dev/pull/1639#discussion_r1319568186


More information about the jdk-updates-dev mailing list