* [ECOS] printf & ptrhread_cancel()
@ 2001-04-16 6:21 Boris V. Guzhov
0 siblings, 0 replies; only message in thread
From: Boris V. Guzhov @ 2001-04-16 6:21 UTC (permalink / raw)
To: ecos-discuss
Hi,
I work with pc386 platform (cvs Snapshot April 5 2001)
There is simple test:
#include <stdio.h>
#include <pthread.h>
#include <time.h>
void *thread_routine(void *arg)
{
for(int count=0;;count++) {
for(int i=0; i<0x500000; i++);
printf("%d\n",count);
/* pthread_testcancel() ;*/
}
return NULL;
}
int main()
{
void *p;
pthread_t th;
pthread_create(&th, NULL, thread_routine, 0);
for(;;) {
for(int i=0; i<0x1000000; i++);
printf("Cancel...\n"); pthread_cancel(th);
printf("join ..."); pthread_join(th, &p); printf(" ret=%x\n", (int)p);
if ( p == PTHREAD_CANCELED )
break;
}
}
It prints:
0
1
Cancel...
If printf() is a cancellation point, I should see on the screen: "join...ret=..."
If printf() is not cancellation point, thread_routine () should work.
But after pthread_cancel() call the system "dies".
What's wrong?
If I uncomment pthread_testcancel() in thread_routine, it works properly.
My configuration:
ecosconfig new pc elix
ecosconfig remove CYGPKG_NET
ecosconfig remove CYGPKG_IO_ETH_DRIVERS
CYGSEM_LIBC_INVOKE_DEFAULT_STATIC_CONSTRUCTORS =1
CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG = 1
Thanks in advance.
--
Boris Guzhov,
St.Petersburg, Russia
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-04-16 6:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-16 6:21 [ECOS] printf & ptrhread_cancel() Boris V. Guzhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).