Made sure that curl_global_init is called in all the multithreaded

example programs.
This commit is contained in:
Dan Fandrich
2008-04-03 20:28:32 +00:00
parent 16a9c5e02b
commit bf52cef16f
5 changed files with 33 additions and 14 deletions

View File

@@ -33,7 +33,7 @@
pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
int j = 0;
gint num_urls = 9; /* Just make sure this is less than urls[]*/
char *urls[]= {
const char * const urls[]= {
"90022",
"90023",
"90024",
@@ -58,7 +58,6 @@ void *pull_one_url(void *NaN)
CURLcode res;
gchar *http;
FILE *outfile;
gint i;
/* Stop threads from entering unless j is incremented */
pthread_mutex_lock(&lock);
@@ -167,7 +166,9 @@ static gboolean cb_delete(GtkWidget *window, gpointer data)
int main(int argc, char **argv)
{
GtkWidget *top_window, *outside_frame, *inside_frame, *progress_bar;
GtkAdjustment *adj;
/* Must initialize libcurl before any threads are started */
curl_global_init(CURL_GLOBAL_ALL);
/* Init thread */
g_thread_init(NULL);