Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-20-2005
andhow andhow is offline
Registered User
 
 
Join Date: Jan 2005
Posts: 16
what can Monitor::wait() throw?

Referring to pg. 648 of the Ice 2.0 docs, they wrap the increment/decrement in a try catch block, which makes sense if wait() can throw. My question is what does Monitor::wait() throw and in what situations? Does this apply to Monitor::timedWait() as well?
Reply With Quote
  #2 (permalink)  
Old 02-21-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
Quote:
Originally Posted by andhow
Referring to pg. 648 of the Ice 2.0 docs, they wrap the increment/decrement in a try catch block, which makes sense if wait() can throw. My question is what does Monitor::wait() throw and in what situations? Does this apply to Monitor::timedWait() as well?
Monitor::wait can throw a ThreadSyscallException in the event of a system call failure. Under a UNIX system wait ends up calling pthread_cond_wait, which can fail for a variety of reasons -- the most common of which is EINTR. Under Windows it can fail if WaitForSingleObject fails. Typically this does not occur.

In addition to ThreadSyscallException Monitor::timedWait can throw a ThreadLockedException if the lock cannot be acquired.

Regards, Matthew
Reply With Quote
  #3 (permalink)  
Old 02-21-2005
andhow andhow is offline
Registered User
 
 
Join Date: Jan 2005
Posts: 16
Ahh, thank you. I know there isn't a black and white answer, but in general, are these the type of exceptions that occur when the system is in a bad state, perhaps it has run out of some threading resource, in which case the application should shut down?
Reply With Quote
  #4 (permalink)  
Old 02-21-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
Quote:
Originally Posted by andhow
Ahh, thank you. I know there isn't a black and white answer, but in general, are these the type of exceptions that occur when the system is in a bad state, perhaps it has run out of some threading resource, in which case the application should shut down?
The MS documentation for WaitForSingleObject is pretty useless in the case of a WAIT_FAILURE error return value. I'm not sure that I've ever seen this error condition myself... so I think it would indicate something very usual has occurred.

As to EINTR, I'm afraid its not possible to give a concrete answer to this without knowing more about your application and its setup. Basically EINTR occurs when the system call is interrupted. If you use signals, and depending how your application sets up the signal state (and whether your flavour of UNIX is POSIX compliant or not) and how it uses signals (I recommend, btw, to stay away from them if at all possible) its possible and sometimes expected for the system call to be interrupted. Is that a sufficiently hand-wavy explanation?

Regards, Matthew
Reply With Quote
  #5 (permalink)  
Old 02-21-2005
andhow andhow is offline
Registered User
 
 
Join Date: Jan 2005
Posts: 16
yessir, that gives me a good idea. thanks!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
icestorm wait bogyom Help Center 8 11-01-2006 04:23 AM
wait-for-activation and register-process can not be templated Yunqiao Yin Bug Reports 2 06-01-2006 12:21 PM
Why does Evictor throw the following exception? kent Help Center 2 01-06-2006 06:01 PM
typedef for Monitor? acbell Comments 1 10-12-2005 03:30 PM
C# samples all throw exceptions on VS.Net 2005 express Leaf Help Center 2 10-09-2004 10:18 PM


All times are GMT -4. The time now is 08:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.