anchor.diff:      ?line Parent = self(),
       ?line F = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS,1000)} end,
       ?line P = spawn(F),
  -    ?line ?EXPECT_ACCEPTS([{P,{error,timeout}}],2000).
  +    ?line ?EXPECT_ACCEPTS([{P,{error,timeout}}],1,2000).
   
   accept_timeouts_in_order(suite) ->
       [];
   accept_timeouts_in_order(doc) ->
       ["Check that multi-accept timeouts happen in the correct order"];
   accept_timeouts_in_order(Config) when is_list(Config) ->
  -    ?line {ok,LS}=gen_tcp:listen(0,[]),
  -    ?line Parent = self(),
  -    ?line P1 = spawn(mktmofun(1000,Parent,LS)),
  -    ?line P2 = spawn(mktmofun(1200,Parent,LS)),
  -    ?line P3 = spawn(mktmofun(1300,Parent,LS)),
  -    ?line P4 = spawn(mktmofun(1400,Parent,LS)),
  -    ?line ?EXPECT_ACCEPTS([{P1,{error,timeout}},{P2,{error,timeout}},
  -			   {P3,{error,timeout}},{P4,{error,timeout}}], 2000).
  +    {ok,LS}=gen_tcp:listen(0,[]),
  +    Parent = self(),
  +    P1 = spawn(mktmofun(1000,Parent,LS)),
  +    P2 = spawn(mktmofun(1200,Parent,LS)),
  +    P3 = spawn(mktmofun(1300,Parent,LS)),
  +    P4 = spawn(mktmofun(1400,Parent,LS)),
  +    ?EXPECT_ACCEPTS([{P1,{error,timeout}},{P2,{error,timeout}},
  +                     {P3,{error,timeout}},{P4,{error,timeout}}],infinity,2000).
   
   accept_timeouts_in_order2(suite) ->
       [];
   accept_timeouts_in_order2(doc) ->
       ["Check that multi-accept timeouts happen in the correct order (more)"];
   accept_timeouts_in_order2(Config) when is_list(Config) ->
  -    ?line {ok,LS}=gen_tcp:listen(0,[]),
  -    ?line Parent = self(),
  -    ?line P1 = spawn(mktmofun(1400,Parent,LS)),
  -    ?line P2 = spawn(mktmofun(1300,Parent,LS)),
  -    ?line P3 = spawn(mktmofun(1200,Parent,LS)),
  -    ?line P4 = spawn(mktmofun(1000,Parent,LS)),
  -    ?line ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P3,{error,timeout}},
  -			   {P2,{error,timeout}},{P1,{error,timeout}}], 2000).
  +    {ok,LS}=gen_tcp:listen(0,[]),
  +    Parent = self(),
  +    P1 = spawn(mktmofun(1400,Parent,LS)),
  +    P2 = spawn(mktmofun(1300,Parent,LS)),
  +    P3 = spawn(mktmofun(1200,Parent,LS)),
  +    P4 = spawn(mktmofun(1000,Parent,LS)),
  +    ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P3,{error,timeout}},
  +                     {P2,{error,timeout}},{P1,{error,timeout}}],infinity,2000).
   
   accept_timeouts_in_order3(suite) ->
       [];
   accept_timeouts_in_order3(doc) ->
       ["Check that multi-accept timeouts happen in the correct order (even more)"];
   accept_timeouts_in_order3(Config) when is_list(Config) ->
  -    ?line {ok,LS}=gen_tcp:listen(0,[]),
  -    ?line Parent = self(),
  -    ?line P1 = spawn(mktmofun(1200,Parent,LS)),
  -    ?line P2 = spawn(mktmofun(1400,Parent,LS)),
  -    ?line P3 = spawn(mktmofun(1300,Parent,LS)),
  -    ?line P4 = spawn(mktmofun(1000,Parent,LS)),
  -    ?line ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P1,{error,timeout}},
  -			   {P3,{error,timeout}},{P2,{error,timeout}}], 2000).
  +    {ok,LS}=gen_tcp:listen(0,[]),
  +    Parent = self(),
  +    P1 = spawn(mktmofun(1200,Parent,LS)),
  +    P2 = spawn(mktmofun(1400,Parent,LS)),
  +    P3 = spawn(mktmofun(1300,Parent,LS)),
  +    P4 = spawn(mktmofun(1000,Parent,LS)),
  +    ?EXPECT_ACCEPTS([{P4,{error,timeout}},{P1,{error,timeout}},
  +                     {P3,{error,timeout}},{P2,{error,timeout}}],infinity,2000).
   
   accept_timeouts_mixed(suite) ->
       [];
   accept_timeouts_mixed(doc) ->
       ["Check that multi-accept timeouts behave correctly when mixed with successful timeouts"];
   accept_timeouts_mixed(Config) when is_list(Config) ->
  -    ?line {ok,LS}=gen_tcp:listen(0,[]),
  -    ?line Parent = self(),
  -    ?line {ok,PortNo}=inet:port(LS),
  -    ?line P1 = spawn(mktmofun(1000,Parent,LS)),
  -    ?line wait_until_accepting(P1,500),
  -    ?line P2 = spawn(mktmofun(2000,Parent,LS)),
  -    ?line wait_until_accepting(P2,500),
  -    ?line P3 = spawn(mktmofun(3000,Parent,LS)),
  -    ?line wait_until_accepting(P3,500),
  -    ?line P4 = spawn(mktmofun(4000,Parent,LS)),
  -    ?line wait_until_accepting(P4,500),
  -    ?line ok = ?EXPECT_ACCEPTS([{P1,{error,timeout}}],1500),
  -    ?line {ok,_}=gen_tcp:connect("localhost",PortNo,[]),
  -    ?line ok = ?EXPECT_ACCEPTS([{P2,{ok,Port0}}] when is_port(Port0),100),
  -    ?line ok = ?EXPECT_ACCEPTS([{P3,{error,timeout}}],2000),	
  -    ?line gen_tcp:connect("localhost",PortNo,[]),
  -    ?line ?EXPECT_ACCEPTS([{P4,{ok,Port1}}] when is_port(Port1),100).
  +    {ok,LS}=gen_tcp:listen(0,[]),
  +    Parent = self(),
  +    {ok,PortNo}=inet:port(LS),
  +    P1 = spawn(mktmofun(1000,Parent,LS)),
  +    wait_until_accepting(P1,500),
  +    P2 = spawn(mktmofun(2000,Parent,LS)),
  +    wait_until_accepting(P2,500),
  +    P3 = spawn(mktmofun(3000,Parent,LS)),
  +    wait_until_accepting(P3,500),
  +    P4 = spawn(mktmofun(4000,Parent,LS)),
  +    wait_until_accepting(P4,500),
  +    ok = ?EXPECT_ACCEPTS([{P1,{error,timeout}}],infinity,1500),
  +    {ok,_}=gen_tcp:connect("localhost",PortNo,[]),
  +    ok = ?EXPECT_ACCEPTS([{P2,{ok,Port0}}] when is_port(Port0),infinity,100),
  +    ok = ?EXPECT_ACCEPTS([{P3,{error,timeout}}],infinity,2000),
  +    gen_tcp:connect("localhost",PortNo,[]),
  +    ?EXPECT_ACCEPTS([{P4,{ok,Port1}}] when is_port(Port1),infinity,100).
   
   killing_acceptor(suite) ->
       [];
  
positive.code:     ?line spawn(F),
      ?line gen_tcp:close(LS),
      ?line ?EXPECT_ACCEPTS([{_,{error,closed}},{_,{error,closed}},
  			   {_,{error,closed}},{_,{error,closed}}], 500).
  	
  accept_timeout(suite) ->
      [];
  
negative.code:     ["checks that multi-accept works when more than one accept can be "
       "done at once (wb test of inet_driver)"];
  several_accepts_in_one_go(Config) when is_list(Config) ->
      {ok,LS}=gen_tcp:listen(0,[]),
      Parent = self(),
      {ok,PortNo}=inet:port(LS),
      F1 = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end,
      F2 = fun() -> Parent ! {connected,self(),gen_tcp:connect("localhost",PortNo,[])} end,
      Ns = lists:seq(1,8),
      _  = [spawn(F1) || _ <- Ns],
      ok = ?EXPECT_ACCEPTS([],1,500), % wait for tmo
      _  = [spawn(F2) || _ <- Ns],
      ok = ?EXPECT_ACCEPTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],8,15000),
      ok = ?EXPECT_CONNECTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],1000),
      ok.
  
  
  