src/Pure/General/sha1.ML
changeset 78716 97dfba4405e3
parent 77896 a9626bcb0c3b
child 78723 3dc56a11d89e
equal deleted inserted replaced
78715:9506b852ebdf 78716:97dfba4405e3
   153     (Foreign.getSymbol
   153     (Foreign.getSymbol
   154       (Foreign.loadLibraryIndirect (fn () => File.platform_path library_path)) "sha1_buffer",
   154       (Foreign.loadLibraryIndirect (fn () => File.platform_path library_path)) "sha1_buffer",
   155       (Foreign.cByteArray, Foreign.cUlong, Foreign.cPointer), Foreign.cPointer);
   155       (Foreign.cByteArray, Foreign.cUlong, Foreign.cPointer), Foreign.cPointer);
   156 
   156 
   157 fun with_memory n =
   157 fun with_memory n =
   158   Thread_Attributes.uninterruptible (fn restore_attributes => fn f =>
   158   Thread_Attributes.uninterruptible (fn run => fn f =>
   159     let
   159     let
   160       val mem = Foreign.Memory.malloc (Word.fromInt n);
   160       val mem = Foreign.Memory.malloc (Word.fromInt n);
   161       val res = Exn.capture (restore_attributes f) mem;
   161       val res = Exn.capture (run f) mem;
   162       val _ = Foreign.Memory.free mem;
   162       val _ = Foreign.Memory.free mem;
   163     in Exn.release res end);
   163     in Exn.release res end);
   164 
   164 
   165 
   165 
   166 (* digesting *)
   166 (* digesting *)