2010-11-17 14 views

Odpowiedz

12

Odpowiedź, w formie komentarza wyciętego i wklejenia z __handles.c - Wiem, dlaczego nie wszyscy myślą, aby tam szukać dokumentacji, prawda?

/* 
* use just one mutex for all the lists, this avoids any issues 
* with deadlocks, the performance issue should be minimal, if it 
* turns out to be a problem, we can readdress this 
* 
* We also have a mutex to protect the connection pooling code 
* 
* If compiled with thread support the DM allows four different 
* thread strategies 
* 
* Level 0 - Only the DM internal structures are protected 
* the driver is assumed to take care of it's self 
* 
* Level 1 - The driver is protected down to the statement level 
* each statement will be protected, and the same for the connect 
* level for connect functions, note that descriptors are considered 
* equal to statements when it comes to thread protection. 
* 
* Level 2 - The driver is protected at the connection level. only 
* one thread can be in a particular driver at one time 
* 
* Level 3 - The driver is protected at the env level, only one thing 
* at a time. 
* 
* By default the driver open connections with a lock level of 3, 
* this can be changed by adding the line 
* 
* Threading = N 
* 
* to the driver entry in odbcinst.ini, where N is the locking level 
* (0-3) 
* 
*/ 
+0

przestań używać myisam ?? –

+0

Myślę, że przegapiłeś ten punkt. Chodzi o to, że można jednoznacznie ustawić poziom wątku do pracy z sterownikami, które zapewniają pewien stopień bezpieczeństwa wątku. myisam nie ma z tym nic wspólnego. – sclv

+0

@sclv, dzięki! Dokumentacja unixODBC jest szokująco skąpa. :/ –

3

Tylko dodatek do tej odpowiedzi. Obecna wersja unixODBC 2.3.0 ma domyślnie wartość Threading = 0, więc domyślnie zakłada się, że sterownik jest bezpieczny dla wątków. Było to ryzykowne założenie w przeszłości, nie tak bardzo teraz.

+0

Debian 6 nadal używa 2.2. –

0

Jeśli sterownik obsługuje funkcje asynchroniczne, można go włączyć i wykonywać czasochłonne funkcje w trybie asynchronicznym.

Po stronie aplikacji nie są wymagane nici.

Powiązane problemy