Do not free common resources when a single instance of the driver is unloaded otherwise other instances of the same driver will cease to function default tip
authorMatthew Sackman <matthew@lshift.net>
Mon Apr 05 23:06:37 2010 +0100 (2010-04-05)
changeset 13f178e55bb6b5
parent 12 a61ccf905d48
Do not free common resources when a single instance of the driver is unloaded otherwise other instances of the same driver will cease to function
c_src/toke.c
src/toke_test.erl
     1.1 --- a/c_src/toke.c	Mon Apr 05 21:30:40 2010 +0100
     1.2 +++ b/c_src/toke.c	Mon Apr 05 23:06:37 2010 +0100
     1.3 @@ -371,13 +371,6 @@
     1.4      driver_free((char*)td->tokyo_error_spec);
     1.5    }
     1.6    driver_free((char*)drv_data);
     1.7 -
     1.8 -  driver_free((char*)no_command_atom_spec);
     1.9 -  driver_free((char*)invalid_command_atom_spec);
    1.10 -  driver_free((char*)no_such_command_atom_spec);
    1.11 -  driver_free((char*)ok_atom_spec);
    1.12 -  driver_free((char*)invalid_state_atom_spec);
    1.13 -  driver_free((char*)not_found_atom_spec);
    1.14  }
    1.15  
    1.16  void toke_new(TokeData *const td, ErlDrvTermData **const spec,
     2.1 --- a/src/toke_test.erl	Mon Apr 05 21:30:40 2010 +0100
     2.2 +++ b/src/toke_test.erl	Mon Apr 05 23:06:37 2010 +0100
     2.3 @@ -5,6 +5,13 @@
     2.4  test() ->
     2.5      {ok, Toke} = toke_drv:start_link(),
     2.6      ok = toke_drv:new(Toke),
     2.7 +
     2.8 +    {ok, Toke2} = toke_drv:start_link(),
     2.9 +    ok = toke_drv:new(Toke2),
    2.10 +
    2.11 +    {ok, Toke3} = toke_drv:start_link(),
    2.12 +    ok = toke_drv:new(Toke3),
    2.13 +
    2.14      ok = toke_drv:set_cache(Toke, 1000000),
    2.15      ok = toke_drv:tune(Toke, 2000000, 5, 15, [large]),
    2.16      ok = toke_drv:open(Toke, "/tmp/test", [read, write, create, truncate]),
    2.17 @@ -24,8 +31,6 @@
    2.18      ok = toke_drv:delete(Toke),
    2.19      ok = toke_drv:stop(Toke),
    2.20  
    2.21 -    {ok, Toke2} = toke_drv:start_link(),
    2.22 -    ok = toke_drv:new(Toke2),
    2.23      ok = toke_drv:set_cache(Toke2, 1000000),
    2.24      ok = toke_drv:tune(Toke2, 2000000, 5, 15, [large]),
    2.25      ok = toke_drv:open(Toke2, "/tmp/test", [read]),
    2.26 @@ -34,8 +39,6 @@
    2.27      ok = toke_drv:delete(Toke2),
    2.28      ok = toke_drv:stop(Toke2),
    2.29  
    2.30 -    {ok, Toke3} = toke_drv:start_link(),
    2.31 -    ok = toke_drv:new(Toke3),
    2.32      ok = toke_drv:set_cache(Toke3, 1000000),
    2.33      ok = toke_drv:tune(Toke3, 2000000, 5, 15, [large]),
    2.34      ok = toke_drv:open(Toke3, "/tmp/test", [read]),