Home > Back-end >  Single thread USES culrlib library automatically exit
Single thread USES culrlib library automatically exit

Time:09-21

Win32 console application in the main thread to create a child thread when the main thread end systerm (" pause ") wait for the child thread running
Started a child thread child have an infinite loop in the thread form of message queue waiting for the data if there are any news come
This time is dia use curl post to upper

Beginning of the child thread curl_easy_init ()

Thread
//prohibited signal
Curl_eays_setopt (m_pCurl CURLOPT_NOSIGNAL, 1 l)

//set the URL address and parameter
Curl_eays_setopt (m_pCurl CURLOPT_HTTPHEADER, headers)
Curl_eays_setopt (m_pCurl, CURLOPT_URL, strurl c_str ())
Curl_eays_setopt (m_pCurl CURLOPT_POSIFIELDS, STR. C_str ())

//set the return value function
Curl_eays_setopt (m_pCurl CURLOPT_WRITEFUNCTION, write_data)
Curl_eays_setopt (m_pCurl CURLOPT_WRITEDATA, & amp; Strdata)

Called end curl_easy_cleanup ()

Short running without any problems in the evening after work to leave in the morning to come over to the main thread is kill off
Don't know which API call is not correct, or still less a great god what step appreciation also hope comment
  • Related