[erlang-questions] Fw: driver_async invoke leads to a segmentation fault

Niranjan Gunasekera niranjan@REDACTED
Wed Dec 27 03:48:09 CET 2006


Can anybody help, please


Thanks
Niranjan Gunasekera
----- Original Message ----- 
From: Niranjan Gunasekera 
To: erlang-questions@REDACTED 
Sent: Friday, December 22, 2006 9:06 AM
Subject: [erlang-questions] driver_async invoke leads to a segmentation fault


Hi all,

    I'm using erlang driver_async to invoke a function asynchronously. First reference to the function 'driver_async' works fine. But next reference to the same call leads to a segmentation fault. I'm using erlang release R11B-2. Same code works fine with erlang release R10B-10. Is it a problem with erlang release?

 

Is it a problem with coding?

 

static int control(ErlDrvData drv_data, unsigned int command, char *buf, int len, char **rbuf, int rlen)

{

--------

            --------

            DriverData *dd = (DriverData *) drv_data;

            set_port_control_flags(dd->port, PORT_CONTROL_FLAG_BINARY);

            ThreadData *threadData;

            if((threadData = (ThreadData *) driver_alloc(sizeof(ThreadData))) == NULL) {

                        error = 1;

            }

            else {

                        error = 0;

                        memset(threadData, 0, sizeof(threadData));

                        if((threadData->input = (char *) driver_alloc(len + 1)) == NULL) {

                                    free(threadData);

                                    error = 1;

                        }

                        else {

                                    ---------

                                    ---------

                                    driver_async(dd->port, NULL, callTextToSpeech, (void *)threadData, freeThreadData);  //first call to this function works fine

                        }

            }

 

            }

            if (error)

                        gen_error_reply(rbuf, rlen, &rindex, "driver_alloc_failiure", 0);

            else

                        gen_ok_reply(rbuf, rlen, &rindex);

}

 

Thanks

Niranjan Gunasekera



--------------------------------------------------------------------------------


_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20061227/de0832b9/attachment.htm>


More information about the erlang-questions mailing list