Changeset 936835e in mainline for uspace/srv/net/tl/icmp/icmp.c
- Timestamp:
- 2010-03-07T15:35:32Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 836dd794
- Parents:
- aadf01e (diff), b5cbff4 (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
-
uspace/srv/net/tl/icmp/icmp.c
raadf01e r936835e 175 175 /** Requests an echo message. 176 176 * Sends a packet with specified parameters to the target host and waits for the reply upto the given timeout. 177 * Blocks the caller until the reply or the timeout occur res.177 * Blocks the caller until the reply or the timeout occurs. 178 178 * @param[in] id The message identifier. 179 179 * @param[in] sequence The message sequence parameter. … … 221 221 222 222 /** Tries to set the pending reply result as the received message type. 223 * If the reply data are still present, the reply timeouted and the parent fibril is awaken.224 * The global lock is not released in this case to be reused by the parent fibril.223 * If the reply data is not present, the reply timed out and the other fibril 224 * is already awake. 225 225 * Releases the packet. 226 226 * @param[in] packet The received reply message. … … 334 334 } 335 335 336 // unlock the globals and wait for areply336 // unlock the globals so that we can wait for the reply 337 337 fibril_rwlock_write_unlock(&icmp_globals.lock); 338 338 … … 340 340 icmp_send_packet(ICMP_ECHO, 0, packet, header, 0, ttl, tos, dont_fragment); 341 341 342 // wait for areply342 // wait for the reply 343 343 // timeout in microseconds 344 344 if(ERROR_OCCURRED(fibril_condvar_wait_timeout(&reply->condvar, &reply->mutex, timeout * 1000))){ 345 345 result = ERROR_CODE; 346 347 // lock the globals again and clean up348 fibril_rwlock_write_lock(&icmp_globals.lock);349 346 }else{ 350 347 // read the result 351 348 result = reply->result; 352 353 // release the reply structure 354 fibril_mutex_unlock(&reply->mutex); 355 } 349 } 350 351 // drop the reply mutex before locking the globals again 352 fibril_mutex_unlock(&reply->mutex); 353 fibril_rwlock_write_lock(&icmp_globals.lock); 356 354 357 355 // destroy the reply structure … … 636 634 // set the result 637 635 reply->result = type; 638 // notify the mainfibril636 // notify the waiting fibril 639 637 fibril_condvar_signal(&reply->condvar); 640 }else{ 641 // unlock only if no reply 642 fibril_rwlock_write_unlock(&icmp_globals.lock); 643 } 638 } 639 fibril_rwlock_write_unlock(&icmp_globals.lock); 644 640 return EOK; 645 641 }
Note:
See TracChangeset
for help on using the changeset viewer.