ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Iam working on an application which requires sending request over n/w to server and receiving responses from the server. I have a seperate user defined function in which i create a socket and all other stuff(bind , send to ,recvfrom), the socket i have created is a datagram , nonblocking socket i also have created a thread which will be pointing to a function which runs an infinite loop and keeps on doing the select() function on the socket to read data from the server if any received in the socket. I also have another user defined function in which i close the socket. My requirement is that when the control enters this function in which i close the socket i need to signal the function which is being pointed by the thread so that it can exit the infinite loop. I tried a google but could not find any solution. If anyone has worked on these lines or have any idea abt how this cud be done i request ur goodselves to help me in this problem
In general, I'd suggest setting a global variable.
In this case, why not use a pipe to signal the thread?
Since you're already blocking on "select()" (a good choice, rather than polling, BTW!), you might want to open a dummy file (e.g. a pipe), add that pipe to your "select()" FD_SET list, and then have the thread that closes the socket "signal" the reader thread by writing to the pipe. Voila!
I don't think there's any way to use a true "signal" (e.g. SIGUSER) here...