The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Process State ianlow UNIX for Dummies Questions & Answers 1 09-06-2006 11:11 AM
state mach{ne... parasa High Level Programming 2 10-20-2005 06:52 AM
IP Blocked debcav Post Here to Contact Site Administrators and Moderators 1 08-21-2005 06:33 PM
BitTorrent port 6969 blocked... how to get around the blocked port PenguinDevil IP Networking 1 05-06-2004 12:03 AM
Telnet Blocked - PGP Encryption? jgordon UNIX for Advanced & Expert Users 7 10-17-2003 09:32 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-07-2002
vjsony vjsony is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 11
Function in a blocked state.

Hi,

How do you write a function which has to stay blocked in a wait state till an event occurs?

The event could be the arrival of a message/updation of a database etc ..

Regards,
VJ
  #2 (permalink)  
Old 08-07-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
Where to start?? The read() system call can block waiting for data, but you can set an option to prevent that. The pause() system csll will block until a signal arrives. And wait() can block until a process dies. In the real old days, that was it.

BSD added select() which can wait until one of several fd's have data available or until a timer expires. I really love select() personally and most versions of Unix have adopted it. The System V folks developed poll(), which I understand is like select.

BSD also added other system calls that can acquire data similiar to read(). These include recv(), recvfrom(), recvmsg(), and readv(). I'm probably leaving some out, but they all can block waiting for data.

There are various forms of IPC2that have been added to unix over the years and many of them can block. An example is msgrcv().

I have the feeling that I'm leaving some stuff out... The list may go on, but one thing that they all have in common is that one process is waiting for another process to do something.

I understand that linux has the ability to allow a process to ask the kernel for delivery of a signal if a file (including a directory) is updated. I don't use linux, but this sounds like an interesting feature.
  #3 (permalink)  
Old 08-08-2002
vjsony vjsony is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 11
Thanks Perderabo.

Regards
VJ
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0