Hello,

We're using ocaml-mysql in our project, savonet, which is highly multithreaded. So we need bindings to declare what are the blocking calls.

Here is a patch to mysql_stubs.c (based on the latest release of ocaml-mysql), which makes it for Mysql.exec. I don't know if there's any other blocking call, we're just using this one.

Thanks for your binding.
--
David
317c317,319
<        
---
>   int length = caml_string_length(sql);
>   char* c_sql = (char*)malloc(length);
> 
320,321c322,331
<         
<   if (mysql_real_query(mysql, String_val(sql), string_length(sql)))
---
> 
>   // The call to exec can be long, so we declare a blocking section.
>   // But we mustn't access caml values in the section, since the GC can
>   // relocate them.
>   memcpy(c_sql,String_val(sql),length);
>   caml_enter_blocking_section();
> 
>   if (mysql_real_query(mysql, c_sql, length)) {
>     caml_leave_blocking_section();
>     free(c_sql);
323c333,335
<   else {
---
>   } else {
>     caml_leave_blocking_section();
>     free(c_sql);

Attachment: signature.asc
Description: OpenPGP digital signature

Répondre à