Ajout d'une fonction de comparaison sur les channels (necessaire entre autres pour Unix.close_process*)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3163 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2000-05-16 09:11:51 +00:00
parent e09e3ba7c7
commit 221c25753b
1 changed files with 8 additions and 1 deletions

View File

@ -376,10 +376,17 @@ static void finalize_channel(value vchan)
stat_free(chan); stat_free(chan);
} }
static int compare_channel(value vchan1, value vchan2)
{
struct channel * chan1 = Channel(vchan1);
struct channel * chan2 = Channel(vchan2);
return (chan1 == chan2) ? 0 : (chan1 < chan2) ? -1 : 1;
}
static struct custom_operations channel_operations = { static struct custom_operations channel_operations = {
"_chan", "_chan",
finalize_channel, finalize_channel,
custom_compare_default, compare_channel,
custom_hash_default, custom_hash_default,
custom_serialize_default, custom_serialize_default,
custom_deserialize_default custom_deserialize_default