Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 26, 2004, 12:53:21 AM (21 years ago)
Author:
bensch
Message:

orxonox/branches/updater: cleaner code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/updater/src/gui/orxonox_gui_update.cc

    r3283 r3284  
    288288      if (!isDownloading)
    289289        {
    290           isDownloading = true;
     290          pthread_join(*downloadThreadFinishID, NULL);
     291
     292          info->stateButton->disconnectSignal(info->buttonSignal);
     293          info->buttonSignal = info->stateButton->connectSignal("button_press_event", info, cancelDownload);
     294#ifdef HAVE_PTHREAD_H
     295          info->stateButton->setTitle("cancel");
     296#else /* HAVE_PTHREAD_H */
     297          info->stateButton->setTitle("please wait");
     298#endif /* HAVE_PTHREAD_H */
     299         
    291300          //! \todo check if threads really were created.
    292301#ifdef HAVE_PTHREAD_H
    293           pthread_join(*downloadThreadFinishID, NULL);
    294302          pthread_create(downloadThreadID, NULL, downloadThread, info);
    295303          pthread_create(downloadThreadFinishID, NULL, downloadThreadFinished, info); 
     
    318326void* OrxonoxGuiUpdate::downloadThread(void* fileInfo)
    319327{
    320 #ifdef HAVE_PTHREAD_H
    321   pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
    322   gdk_threads_enter();
    323 #endif /* HAVE_PTHREAD_H */
    324   FileInfo* info = (FileInfo*)fileInfo;
    325   info->stateButton->disconnectSignal(info->buttonSignal);
    326   info->buttonSignal = info->stateButton->connectSignal("button_press_event", info, cancelDownload);
    327 #ifdef HAVE_PTHREAD_H
    328   info->stateButton->setTitle("cancel");
    329   gdk_threads_leave();
    330 #else /* HAVE_PTHREAD_H */
    331   info->stateButton->setTitle("please wait");
    332 #endif /* HAVE_PTHREAD_H */
    333   pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
    334 
     328  isDownloading = true;
    335329  curl_easy_perform(curlHandle);
    336330}
Note: See TracChangeset for help on using the changeset viewer.