On 01/19/2012 10:38 PM, Cyril Hrubis wrote:

> Hi!
>> @@ -121,34 +114,24 @@ main ()
>>              aiocbs[i]->aio_buf = &bufs[i * BUF_SIZE];
>>              aiocbs[i]->aio_nbytes = BUF_SIZE;
>>              aiocbs[i]->aio_lio_opcode = LIO_READ;
>> -
>> -            /* Use SIRTMIN+1 for individual completions */
>> -            aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
>> -            aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN + 1;
>> -            aiocbs[i]->aio_sigevent.sigev_value.sival_int = i;
>>      }
>>  
>> -    /* Use SIGRTMIN+2 for list completion */
>> +    /* Use SIGRTMIN + 1 for list completion */
>>      event.sigev_notify = SIGEV_SIGNAL;
>> -    event.sigev_signo = SIGRTMIN + 2;
>> +    event.sigev_signo = SIGRTMIN + 1;
>>      event.sigev_value.sival_ptr = NULL;
>>  
>> -    /* Setup handler for individual operation completion */
>> +    /* Setup handler for list completion */
>>      action.sa_sigaction = sigrt1_handler;
>>      sigemptyset(&action.sa_mask);
>>      action.sa_flags = SA_SIGINFO | SA_RESTART;
>>      sigaction(SIGRTMIN + 1, &action, NULL);
>>  
>> -    /* Setup handler for list completion */
>> -    action.sa_sigaction = sigrt2_handler;
>> -    sigemptyset(&action.sa_mask);
>> -    action.sa_flags = SA_SIGINFO | SA_RESTART;
>> -    sigaction(SIGRTMIN + 2, &action, NULL);
>> -
>>      /* Setup suspend list */
>>      plist[0] = NULL;
>>      plist[1] = aiocbs[WAIT_FOR_AIOCB];
>>  
>> +resubmit:
>>      /* Submit request list */
>>      ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event);
>>  
>> @@ -162,21 +145,11 @@ main ()
>>              exit(PTS_UNRESOLVED);
>>      }
>>  
>> -    /* Check selected request has not completed yet */
>> -    if (received_selected) {
>> -            printf(TNAME " Error : AIOCB %d already completed before 
>> suspend\n",
>> -                    WAIT_FOR_AIOCB);
>> -            for (i = 0; i < NUM_AIOCBS; i++)
>> -                    free (aiocbs[i]);
>> -            free(bufs);
>> -            free(aiocbs);
>> -            close(fd);
>> -            exit(PTS_FAIL);
>> -    }
>> +    if (aio_error(aiocbs[WAIT_FOR_AIOCB]) != EINPROGRESS)
>> +            goto resubmit;
> 
> I would rather do 
> 
> do {
> 
> } while (...)


yeah, I can change to this.

> 
> instead of the goto here and perhaps have some limit on the number of
> retries.
> 
> And shoudn't we wait for other aio request before we resubmit the whole
> list again?


no need, we just need to take care of this one here, since we will wait
the others after the aio_suspend().


Thanks
-Wanlong Gao

> 



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to