Changeset cac458f in mainline for uspace/lib/c/generic/net/modules.c
- Timestamp:
- 2011-06-22T01:59:39Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 41e2118
- Parents:
- 79506d6 (diff), f1fae414 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/lib/c/generic/net/modules.c ¶
r79506d6 rcac458f 114 114 async_client_conn_t client_receiver) 115 115 { 116 return bind_service_timeout(need, arg1, arg2, arg3, client_receiver, 0);117 }118 119 /** Create bidirectional connection with the needed module service and registers120 * the message receiver.121 *122 * @param[in] need The needed module service.123 * @param[in] arg1 The first parameter.124 * @param[in] arg2 The second parameter.125 * @param[in] arg3 The third parameter.126 * @param[in] client_receiver The message receiver.127 * @param[in] timeout The connection timeout in microseconds. No timeout if128 * set to zero (0).129 *130 * @return The phone of the needed service.131 * @return ETIMEOUT if the connection timeouted.132 * @return Other error codes as defined for the ipc_connect_to_me()133 * function.134 *135 */136 int bind_service_timeout(services_t need, sysarg_t arg1, sysarg_t arg2,137 sysarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)138 {139 116 /* Connect to the needed service */ 140 int phone = connect_to_service _timeout(need, timeout);117 int phone = connect_to_service(need); 141 118 if (phone >= 0) { 142 119 /* Request the bidirectional connection */ … … 159 136 int connect_to_service(services_t need) 160 137 { 161 return connect_to_service_timeout(need, 0); 162 } 163 164 /** Connects to the needed module. 165 * 166 * @param[in] need The needed module service. 167 * @param[in] timeout The connection timeout in microseconds. No timeout if 168 * set to zero (0). 169 * @return The phone of the needed service. 170 * @return ETIMEOUT if the connection timeouted. 171 */ 172 int connect_to_service_timeout(services_t need, suseconds_t timeout) 173 { 174 int phone; 175 176 /* If no timeout is set */ 177 if (timeout <= 0) 178 return service_obsolete_connect_blocking(need, 0, 0); 179 180 while (true) { 181 phone = service_obsolete_connect(need, 0, 0); 182 if ((phone >= 0) || (phone != ENOENT)) 183 return phone; 184 185 /* Abort if no time is left */ 186 if (timeout <= 0) 187 return ETIMEOUT; 188 189 /* Wait the minimum of the module wait time and the timeout */ 190 usleep((timeout <= MODULE_WAIT_TIME) ? 191 timeout : MODULE_WAIT_TIME); 192 timeout -= MODULE_WAIT_TIME; 193 } 138 return service_obsolete_connect_blocking(need, 0, 0); 194 139 } 195 140
Note:
See TracChangeset
for help on using the changeset viewer.