in reply to Re^5: XS: free() outside of the main thread causes crash on Windows
in thread XS: free() outside of the main thread causes crash on Windows

I changed it to
#include <pthread.h> void *thread(void *arg) { char *msg = (char*)arg; printf("thread: %s\n", msg); free(msg); return NULL; } #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" MODULE = My PACKAGE = My void test_thread(char *msg) PPCODE: char *thread_arg = malloc((strlen(msg)+1)*sizeof(char)); strcpy(thread_arg, msg); pthread_t tid; pthread_create(&tid, NULL, thread, (void*)thread_arg); void *rv; pthread_join(tid, &rv);

And the problem still here: crash on each run
  • Comment on Re^6: XS: free() outside of the main thread causes crash on Windows
  • Download Code

Replies are listed 'Best First'.
Re^7: XS: free() outside of the main thread causes crash on Windows
by Anonymous Monk on Sep 25, 2014 at 08:28 UTC

    And the problem still here: crash on each run

    No problem for me I got citrusperl 5.16.1 with

    $ gcc --version gcc (gcc-4.6.3 release with patches [build 20121012 by perlmingw.sf.ne +t]) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There i +s NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR +POSE.
      I am testing on ActiveState perl