[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Terminering af tråde



torsdag 27 Marts 2008 skrev Peter Maersk-Moller:

> Er der noget med at man kan bruge signal() til at få en blokeret read 
> til returnere ... bare uden at der er læst noget og med errno sat ? Vist 
> nok til EAGAIN. Hmm man siger vist noget andet, men maaske kunne den 
> sætte EINTR ? Ville det være en ide, at låse op for blocking read med 
> signal og få dem til at returnerer-exit'te selv ?

Det er ikke den værste ide, ihvertfald, selvom signaler til tråde tidligere 
har været noget flaky under Linux. Jeg tror det er iorden nu.

> Hmm, hvordan er det lige man læser errno, når man har et par tusinde 
> blokerede reads eller writes ? errno er jo en fælles variabel for alle 
> io-operationer.

Mnej. man 3 errno:

errno is thread-local; setting it in one thread does not affect its value in 
any other thread.

> 
> Hvis SIGALRM er brugt til at få read() til at returnere med errno sat 
> til EINTR, rejser det et par issues
> 
>    a) Er der kun en read(), der returnerer med errno sat til EINTR per 
> SIGALRM eller er det alle måske flere tusinde read(), der returnerer ?

Principielt er det vel den tråd der får signalet. Borset fra det, gør det vel 
en minimal forskel?
> 
>    b) Hvis read() returnerer -1 med errno sat til EINTR når jeg 
> genererer SIGALRM, hvordan sikre man sig, at man kan læse errno inden en 
> anden tråds I/O ændrer værdien i errno ?

Det er ikke noget problem - se ovenfor :-)

Mvh

Mads

-- 
Mads Bondo Dydensborg.                               sslug@sslug
I don't even consider working for MS Shops, or shops with extensive MS
deployment anymore. These companies are rape victims, and too self-abusive to 
get away. Why waste time trying to help those who will not help themselves? 
                                                       - David C. Manchester



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2008-04-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *