示例#1
0
/* Function: DisconnectFromHost ================================================
 * Abstract:
 *  Disconnect from the host.
 */
PRIVATE void DisconnectFromHost(bool sendFinalUpload, int_T numSampTimes)
{
    int i;

    for (i=0; i<NUM_UPINFOS; i++) {
        if (sendFinalUpload) {
            UploadPrepareForFinalFlush(i);
            UploadServerWork(i, numSampTimes);
            UploadLogInfoTerm(i, numSampTimes);
        }
    }
    
    connected       = FALSE;
    commInitialized = FALSE;
    
    ExtCloseConnection(extUD);
} /* end DisconnectFromHost */
示例#2
0
/* Function: DisconnectFromHost ================================================
 * Abstract:
 *  Disconnect from the host.
 */
PRIVATE void DisconnectFromHost(int_T numSampTimes)
{
    int i;

    for (i=0; i<NUM_UPINFOS; i++) {
        UploadPrepareForFinalFlush(i);

#if defined(QNX_OS)
        /*
         * UploadPrepareForFinalFlush() has already called semGive(uploadSem)
         * two times.  Now the server thread will wait until the upload thread
         * has processed all of the data in the buffers for the final upload
         * and exhausted the uploadSem semaphores.  If the server thread
         * attempts to call UploadServerWork() while the upload thread is in
         * the middle of processing the buffers, the target code may crash
         * with a NULL pointer exception (the buffers are destroyed after
         * calling UploadLogInfoTerm).
         */
#if 0
        while(semTake(uploadSem, NO_WAIT) != ERROR) {
            semGive(uploadSem);
            taskDelay(1000);
        }
#endif
       while (sem_trywait(uploadSem) == 0) {
          sem_post(uploadSem);
          sched_yield();
          
       }
       
      
#else
        UploadServerWork(i, numSampTimes);
#endif

        UploadLogInfoTerm(i, numSampTimes);
    }
    
    connected       = FALSE;
    commInitialized = FALSE;
    
    ExtCloseConnection(extUD);
} /* end DisconnectFromHost */
/* Function: DisconnectFromHost ================================================
 * Abstract:
 *  Disconnect from the host.
 */
PRIVATE void DisconnectFromHost(int_T numSampTimes)
{
    int i;

    for (i=0; i<NUM_UPINFOS; i++) {
        UploadPrepareForFinalFlush(i);

#if defined(VXWORKS)
        /*
         * UploadPrepareForFinalFlush() has already called semGive(uploadSem)
         * two times.  Now the server thread will wait until the upload thread
         * has processed all of the data in the buffers for the final upload
         * and exhausted the uploadSem semaphores.  If the server thread
         * attempts to call UploadServerWork() while the upload thread is in
         * the middle of processing the buffers, the target code may crash
         * with a NULL pointer exception (the buffers are destroyed after
         * calling UploadLogInfoTerm).
         */
        while(semTake(uploadSem, NO_WAIT) != ERROR) {
            semGive(uploadSem);
            taskDelay(1000);
        }
#else
#ifndef EXTMODE_DISABLESIGNALMONITORING
        if (host_upstatus_is_uploading) {
            UploadServerWork(i, numSampTimes);
        }
#endif
#endif

        UploadLogInfoTerm(i, numSampTimes);
    }
    
    connected       = false;
    commInitialized = false;
    
    ExtCloseConnection(extUD);
} /* end DisconnectFromHost */
示例#4
0
/* Function: DisconnectFromHost ================================================
 * Abstract:
 *  Disconnect from the host.
 */
PRIVATE void DisconnectFromHost(SimStruct *S)
{
    UploadPrepareForFinalFlush();
#ifdef VXWORKS
    /*
     * Patch by Gopal Santhanam 5/24/2002 (for VXWORKS) We
     * were having problems in RTAI in that the semaphore
     * signaled in UploadPrepareForFinalFlush was taken up by
     * the upload server task.  This meant that the subsequent
     * call to rt_UploadServerWork in this function would
     * block indefinitely!
     */
    semGive(uploadSem);
#endif
    rt_UploadServerWork(S);
    
    UploadLogInfoTerm();

    connected       = FALSE;
    commInitialized = FALSE;

    ExtCloseConnection(extUD);
} /* end DisconnectFromHost */