Sponsored Content
Full Discussion: multithreads and IO ports
Top Forums Programming multithreads and IO ports Post 93821 by jim mcnamara on Thursday 22nd of December 2005 10:05:33 AM
Old 12-22-2005
I can't see all of what you're doing (please use code tags) but are you creating two separate fd's for these ports?

Plus, threads receive signals, not just one of them. Your code is confusing me - try looking at Steven's Advanced Programming in the UNIX Envrionment section 12.8 deals with threads and signals.

I think this is what you're asking...:

One process with two threads - each one controlling a port?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ports

How To Close ports,for example finger port 79?? :confused: :confused: :confused: 10x (6 Replies)
Discussion started by: Yaki
6 Replies

2. UNIX for Dummies Questions & Answers

Ports

I know i can look in the /etc/services file to look at referenced port numbers, but is there a command that will list the current ports being used? (i.e. what is the application does not have an entry in the services files :confused: ) (2 Replies)
Discussion started by: Ralf
2 Replies

3. IP Networking

ports???

Ok, I've been working in the IT field for about 3 years now and I never fully understood the concept of ip ports. I just started a new job that uses Solaris and today it kinda clicked in my head and I want to know if I'm right or wrong. Does each ip address have multiple ports. because we... (4 Replies)
Discussion started by: eloquent99
4 Replies

4. IP Networking

Ports

What are some good sites that list all TPC/UDP ports? ~thanks (3 Replies)
Discussion started by: ireeneek
3 Replies

5. UNIX for Dummies Questions & Answers

Ports...

Hello UNIX people... This is my first foray into the UNIX world so go easy on me... I have a client who has hired me to do some work on his windows stuff, BUT it just so happens his UNIX server started giving him problems... He is running SCO Open Server 5.0.6 The TTY ports won't... (5 Replies)
Discussion started by: TechKnow
5 Replies

6. HP-UX

Ports

Can any one tell the command for which process are running on a perticular port (1 Reply)
Discussion started by: zsujith
1 Replies

7. Solaris

regarding ports

Hi , I need one help... Is there any command on solaris 10 to free the ports. For e.g I used netstat -na| grep 8080 it displays either it is listening or established.. i want to free the ports... Anyone please help me on this... Thanks, Shanmuga (2 Replies)
Discussion started by: shanshine
2 Replies

8. Solaris

ports

Hi, If for example i try to start tomcat in a solaris server and get errors related to address already in use, how can I know if this port is really used for another process? If someone can point any documentation it will be very helpfull. Thanks! :rolleyes: (9 Replies)
Discussion started by: ffpradella
9 Replies

9. UNIX for Dummies Questions & Answers

ports

When the netstat -an command is run on current unix machine, it seems that there's an excessive amount of ports established (roughly 600). How can I tell what each of these ports are being used for? (1 Reply)
Discussion started by: lastchance551
1 Replies

10. UNIX for Advanced & Expert Users

Ports

** forum admins: Before you come down on my like a wrath of something, I can get no decent answers so I have to come to these Gurus' court *** I am by no means Unix expert. However, none of our unix admin (aix & hpux) can give me an answer that makes sense. My Issue: Assigned ports in 8601,... (7 Replies)
Discussion started by: rsheikh
7 Replies
PTHREAD_SIGNAL(3)					     Library Functions Manual						 PTHREAD_SIGNAL(3)

NAME
pthread_sigmask, pthread_kill, sigwait - handling of signals in threads SYNOPSIS
#include <pthread.h> #include <signal.h> int pthread_sigmask(int how, const sigset_t *newmask, sigset_t *oldmask); int pthread_kill(pthread_t thread, int signo); int sigwait(const sigset_t *set, int *sig); DESCRIPTION
pthread_sigmask changes the signal mask for the calling thread as described by the how and newmask arguments. If oldmask is not NULL, the previous signal mask is stored in the location pointed to by oldmask. The meaning of the how and newmask arguments is the same as for sigprocmask(2). If how is SIG_SETMASK, the signal mask is set to newmask. If how is SIG_BLOCK, the signals specified to newmask are added to the current signal mask. If how is SIG_UNBLOCK, the signals specified to newmask are removed from the current signal mask. Recall that signal masks are set on a per-thread basis, but signal actions and signal handlers, as set with sigaction(2), are shared between all threads. pthread_kill send signal number signo to the thread thread. The signal is delivered and handled as described in kill(2). sigwait suspends the calling thread until one of the signals in set is delivered to the calling thread. It then stores the number of the signal received in the location pointed to by sig and returns. The signals in set must be blocked and not ignored on entrance to sigwait. If the delivered signal has a signal handler function attached, that function is not called. CANCELLATION
sigwait is a cancellation point. RETURN VALUE
On success, 0 is returned. On failure, a non-zero error code is returned. ERRORS
The pthread_sigmask function returns the following error codes on error: EINVAL how is not one of SIG_SETMASK, SIG_BLOCK, or SIG_UNBLOCK EFAULT newmask or oldmask point to invalid addresses The pthread_kill function returns the following error codes on error: EINVAL signo is not a valid signal number ESRCH the thread thread does not exist (e.g. it has already terminated) The sigwait function never returns an error. AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr> SEE ALSO
sigprocmask(2), kill(2), sigaction(2), sigsuspend(2). NOTES
For sigwait to work reliably, the signals being waited for must be blocked in all threads, not only in the calling thread, since otherwise the POSIX semantics for signal delivery do not guarantee that it's the thread doing the sigwait that will receive the signal. The best way to achieve this is block those signals before any threads are created, and never unblock them in the program other than by calling sigwait. BUGS
Signal handling in LinuxThreads departs significantly from the POSIX standard. According to the standard, ``asynchronous'' (external) sig- nals are addressed to the whole process (the collection of all threads), which then delivers them to one particular thread. The thread that actually receives the signal is any thread that does not currently block the signal. In LinuxThreads, each thread is actually a kernel process with its own PID, so external signals are always directed to one particular thread. If, for instance, another thread is blocked in sigwait on that signal, it will not be restarted. The LinuxThreads implementation of sigwait installs dummy signal handlers for the signals in set for the duration of the wait. Since signal handlers are shared between all threads, other threads must not attach their own signal handlers to these signals, or alternatively they should all block these signals (which is recommended anyway -- see the Notes section). LinuxThreads PTHREAD_SIGNAL(3)
All times are GMT -4. The time now is 07:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy