Привет
Есть поток (pthread_create) который прослушивает сокет (read). Как
в info написанно, после pthread_cancel, read должен вылететь с EINTR
но ничего подобного не происходит. Пробовал всякие бругие cancelation points - безрезультатно, скорей всего я чего-то недопонимаю,
всетаки:
glibc-2.3.1
gcc-3.2.2/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i386-slackware-linux --host=i386-slackware-linux
Thread model: posix
gcc version 3.2.2
Кстати что значит --enable-threads=posix ? Есть еще какие-то ?
Набросал небольшой пример для большей вразумительности:
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <string.h>
void *pthread_differed(void *) {
int i = 0;
while (true) {
pause(); // cancelation point
printf("pthread_differed: %i\n", i++);
}
}
int main() {
pthread_t thread;
pthread_create(&thread, NULL, pthread_differed, NULL);
sleep(5);
pthread_cancel(thread);
pthread_join(thread, NULL);
sleep(10);
return 0;
}
Заранее спасибо
Форум —
Development