int shmem_transport_fini(void) { ptl_ct_event_t ct; /* synchronize the atomic cache, if there is one */ PtlAtomicSync(); /* wait for remote completion (acks) of all pending events */ PtlCTWait(shmem_transport_portals4_put_ct_h, shmem_transport_portals4_pending_put_counter, &ct); if (shmem_transport_portals4_pending_put_counter != ct.success + ct.failure) { fprintf(stderr, "[%03d] WARNING: put count mismatch: %ld, %ld\n", shmem_internal_my_pe, (long) shmem_transport_portals4_pending_put_counter, (long) (ct.success + ct.failure)); } PtlCTWait(shmem_transport_portals4_get_ct_h, shmem_transport_portals4_pending_get_counter, &ct); if (shmem_transport_portals4_pending_get_counter != ct.success + ct.failure) { fprintf(stderr, "[%03d] WARNING: get count mismatch: %ld, %ld\n", shmem_internal_my_pe, (long) shmem_transport_portals4_pending_get_counter, (long) (ct.success + ct.failure)); } cleanup_handles(); PtlFini(); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_pt_state); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_frag); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_event_slots); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_nb_fence); return 0; }
void load_new_handles(struct urllist *ul, struct http_data *data, void *db){ struct urllist *tul; int i; tul=ul; data->anp=0; for(i=0;i<data->npara;i++){ if(tul==NULL) break; if(tul->data.n_httperr<0){ tul->data.n_httperr=0; } else if(tul->data.n_httperr==0 || tul->data.n_httperr>=global_config.dl_retries){ tul=tul->next; while(tul && (tul->data.n_httperr>=global_config.dl_retries || tul->data.n_httperr==0)) tul=tul->next; if(tul==NULL) break; if(tul->data.n_httperr<0) tul->data.n_httperr=0; } data->ula[i]=tul; if(tul->data.info.doc){ xmlproc_free_doc(tul->data.info.doc); tul->data.info.doc=NULL; } xmlproc_init(data->xh+i,tul); data->ce[i]=curl_easy_init(); /* send all data to this function */ curl_easy_setopt(data->ce[i],CURLOPT_WRITEFUNCTION,write_memory_cb); curl_easy_setopt(data->ce[i],CURLOPT_WRITEDATA,(void *)(data->xh+i)); curl_easy_setopt(data->ce[i],CURLOPT_USERAGENT,"newsbaoter/0.1"); curl_easy_setopt(data->ce[i],CURLOPT_FOLLOWLOCATION,1); curl_easy_setopt(data->ce[i],CURLOPT_URL,tul->data.url); if(global_config.proxy) curl_easy_setopt(data->ce[i],CURLOPT_PROXY,global_config.proxy); curl_multi_add_handle(data->cm,data->ce[i]); tul=tul->next; data->anp++; } if(data->anp==0) goto empty; return; empty: cleanup_handles(data,db); }