나는이 질문을 영원히 생각해 냈기 때문에이 질문에 답할 것입니다. 응답은 여기에 있었으면합니다.다중 스레드 동시 설정에서 unixODBC 사용
문제점 : 하나의 장기 실행 unixODBC 쿼리가 동일한 응용 프로그램의 다른 모든 블록을 차단합니다.
질문 : 어떻게 이런 일이 일어나지 않습니까?
나는이 질문을 영원히 생각해 냈기 때문에이 질문에 답할 것입니다. 응답은 여기에 있었으면합니다.다중 스레드 동시 설정에서 unixODBC 사용
문제점 : 하나의 장기 실행 unixODBC 쿼리가 동일한 응용 프로그램의 다른 모든 블록을 차단합니다.
질문 : 어떻게 이런 일이 일어나지 않습니까?
__handles.c의 잘라 내기 및 붙여 넣기 주석 형식의 답변 - 모든 사람이 문서화를 처음부터 보지 않는 이유는 무엇입니까?
/*
* 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)
*
*/
그냥 그 답변에 추가. unixODBC 2.3.0의 현재 릴리스는 기본적으로 스레딩 = 0이므로 기본값은 해당 드라이버가 스레드 안전하다고 가정하는 것입니다. 이것은 과거의 위험한 가정이었습니다.
데비안 6은 여전히 2.2를 사용합니다. –
드라이버가 비동기 함수를 지원하는 경우 비동기 함수를 활성화하고 비동기 모드에서 시간 소모적 인 함수를 실행할 수 있습니다.
응용 프로그램 측면에서 스레드가 필요하지 않습니다.
myisam을 사용하여 중단 하시겠습니까 ?? –
나는 그 점을 놓쳤다 고 생각합니다. 요점은, 어느 정도의 thread 안전을 독자적으로 제공하는 드라이버로 동작하도록, 스레딩 레벨을 명시 적으로 설정할 수있는 점입니다. myisam은 이것과 아무런 관련이 없습니다. – sclv
@sclv, 감사합니다! unixODBC 문서는 놀라 울 정도로 희소합니다. :/ –