Mes salutations distinguées ,

Me revoilà avec un problème concernant boost (boost::archive) et le multithreading. J'obtiens un segfault lorsque j'utilise la serialization, un morceau de code vous sera certainement plus parlant.

Voici la boucle multithreadé:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
while (1) {
	glfwLockMutex(mutex);
	haveToQuit = mustDie;
	glfwUnlockMutex(mutex);
 
	if (haveToQuit) {
		break;
	}
 
	glfwLockMutex(mutexStats); // un mutex static !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
	boost::asio::streambuf sendBuff;
	std::ostream send_stream(&sendBuff);
	boost::archive::text_oarchive oTextArchive(send_stream);
 
	pkInfo piS;
	piS.type = pkInfo::PIT_NULL;
	piS.nb = 0;
	oTextArchive << piS;
 
	// Send the request.
	boost::asio::write(sock, sendBuff);
 
	std::ostringstream oss;
 
	// Read the response
	boost::asio::streambuf readBuff;
	boost::asio::read_until(sock, readBuff, "\0");
 
	std::istream read_stream(&readBuff);
	boost::archive::text_iarchive iTextArchive(read_stream);
 
	pkInfo piR;
	try {
		iTextArchive >> piR; // LABEL IARCHIVE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	}
	catch (...) {
		log->log (Logger::IMPORTANT, "IAClient::routineDeIAClient", "exception betwen mutex");
	}
 
 
	glfwUnlockMutex(mutexStats); // ET le unlock !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 
	fprintf (stdout, "after iArchive:%s\n", tbName.c_str());fflush (stdout);
	glfwSleep(timeToSleep);
}
Pas de backtrace . Le problème se manifeste le plus souvent sur le label IARCHIVE.

Chez boost, ils disent http://www.boost.org/doc/libs/1_42_0...ulti_threading ...
je suis pas sur d'avoir tout compris , mais ca ne devrait pas être ca.

However, Writing/Reading different archives simultaneously in different tasks is permitted as each archive instance is (almost) completely independent from any other archive instance.
Je comprend pas trop le "(almost) completely independent".

Lorsque, j'utilise les mutex, ca plante pas. Est ce une preuve que la portion de code entre le lock/unlock n'est pas thread-safe ?

la lib utilisé : -llibboost_serialization-mgw34-mt-d-1_42

Je crois que c'est tout. Merci à tout ceux qui se sont penché sur mon cas.