sem_timedwait()

"arnulfo2lvz" <[email protected]> Mon, 18 Apr 2005 18:15:09 -0000
Newsgroups gmane.comp.lang.delphi.kylix
Message-ID <[email protected]>

do you see any problem in the following pascal code?

var
  Semaphore: TSemaphore;

procedure SomethingProc;
var
 Timeout: timespec;
begin
  Timeout.tvsec := 30;
  Timeout.tv_nsec := 0;
  if sem_timedwait(Semaphore, Timeout) <> 0 then
    ErrorMessage('timeout');

  try
    Sleep(2000);
  finally
    sem_post(Semaphore);    
  end;   
end;

initialization
  if sem_init(Semaphore, false, 3) <> 0 then
    raise Exception.Create('sem_init');

finalization
  if sem_destroy(Semaphore) <> 0 then
    raise Exception.Create('sem_destroy');


the problem is, sem_timedwait() does nothing and the
code below it does not execute. Completely aborts
SomethingProc(), no error messages;

sem_wait() and sem_trywait() works fine. any thoughts?



		





-------------------------------------------------------
Forum / mailing list for Borland Kylix programmers
Our web page:  http://groups.yahoo.com/group/kylixgroup
To join the forum: [email protected]
To unsubscribe:  [email protected]
To post your messages:       [email protected]
To contact the moderator:  [email protected]
------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/KylixGroup/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/