Article View: es.comp.os.linux.programacion
Article #2112socket con threads
From: Nor
Date: Sun, 17 Apr 2005 16:47
Date: Sun, 17 Apr 2005 16:47
23 lines
1781 bytes
1781 bytes
Buenas:
Estoy haciendo una palicacioncilla con threads y me ha derivado en lo
siguiente:
Dos threads que atacan a un mismo socket y uno de ellos lee del socket y el
otro escribe.
Hay momentos en los que la aplicacion se me bloquea y casualmente es cuando
un thread esta haciendo el read y el otro el write.
Me da que esto no se puede hacer sin usar un mutex, pero tambien he viso:
MULTITHREAD USAGE (man de socket(2) de hp)
The socket() system call is safe to be called by multithreaded applications,
and it is thread-safe for both POSIX Threads and DCE User Threads. It has a
cancellation point. It is async-cancel safe, async-signal safe, and
fork-safe.
Y se me queda en __write_nocancel y __read_nocancel, asi que no se si tengo
que usar un mutex o no.
Sabe alguien algun link de documentacion sobre esto o si tengo que poner al
sochet alguna opcion o algo??
Un saludo y gracias
Technical Details
Message-ID:
<Fqw8e.59872$r7.69508@telenews.teleline.es>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!fu-berlin.de!nsnmpen1-lo.nuria.telefonica-data.net!telenews.teleline.es!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f86c8,4f96ad5a2fc9cd79,start X-Google-Attributes: gidf86c8,public X-Google-Language: SPANISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!fu-berlin.de!nsnmpen1-lo.nuria.telefonica-data.net!telenews.teleline.es!not-for-mail X-Trace-PostClient-IP: 217.125.115.23 From: Nor <soynor@gmail.com> Subject: socket con threads Newsgroups: es.comp.os.linux.programacion Lines: 23 User-Agent: KNode/0.8.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: <Fqw8e.59872$r7.69508@telenews.teleline.es> Date: Sun, 17 Apr 2005 16:47:33 GMT NNTP-Posting-Host: 10.20.31.4 X-Complaints-To: usenet@teleline.es X-Trace: telenews.teleline.es 1113756453 10.20.31.4 (Sun, 17 Apr 2005 18:47:33 MET DST) NNTP-Posting-Date: Sun, 17 Apr 2005 18:47:33 MET DST Organization: Terra Networks