apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dongsheng Song" <dongsheng_s...@hotmail.com>
Subject win2k apr thread Access Violation
Date Tue, 09 Dec 2003 03:50:07 GMT
I use apr with httpd 2.0.48, in vc6sp5 debug mode, when thread die, at ExitThread throws:

Unhandled exception in xxx.exe(MSVCRT.DLL): 0xC0000005: Access Violation

But in release mode, no errors. The test code is:
#include "apr_portable.h"

void * __stdcall worker(apr_thread_t *thd, void * data)
{
 int i = *(int *)data;

 //apr_thread_detach(thd);

 fprintf(stdout, "i: %d\n", i);

 apr_thread_exit(thd, APR_SUCCESS);

 return NULL;
}

int main(int argc, char *argv[])
{
 apr_pool_t *pool = NULL;
 apr_thread_t *at = NULL;
 apr_status_t status = 0, rc = 0;
 int i = 120;

 status = apr_pool_initialize();
 if(status != APR_SUCCESS) {
  abort();
 }
 //atexit(apr_terminate);

 status = apr_pool_create(&pool, NULL);
 status = apr_thread_create(&at, NULL, worker, &i, pool);

 status = apr_thread_join(&rc, at);

 return 0;
}
Mime
View raw message