pri queue manager/attached .erl file - spawned process exiting

Vance Shipley vances@REDACTED
Fri Apr 19 17:36:22 CEST 2002


Sameer,

The start function has some problems:

start(L) ->
        io:format("Queue: ~w~n",[L]),
        QmPid = spawn(qm,qm,[L]).

The first argument to spawn should be the module name,
in this case 'qmpri'.  The QmPid variable assignment
does noting here as it is lost as soon as the function
is done.

Change it to:

start(L) ->
        io:format("Queue: ~w~n",[L]),
        spawn(qmpri,qm,[L]).

Now you get a process running as you see here:

Erlang (BEAM) emulator version 5.1.1 [source]

Eshell V5.1.1  (abort with ^G)
1> c(qmpri).
{ok,qmpri}
2> Qm=qmpri:start([1,2,3,4]).
Queue: [1,2,3,4]
<0.33.0>
3> i(0, 33, 0).
[{current_function,{qmpri,qm,1}},
 {initial_call,{qmpri,qm,1}},
 {status,waiting},
 {message_queue_len,0},
 {messages,[]},
 {links,[]},
 {dictionary,[]},
 {trap_exit,false},
 {error_handler,error_handler},
 {priority,normal},
 {group_leader,<0.21.0>},
 {heap_size,233},
 {stack_size,3},
 {reductions,1},
 {garbage_collection,[{fullsweep_after,65535}]}]


	-Vance

On Fri, Apr 19, 2002 at 07:51:30PM +0530, Sameer Pendse wrote:
}  guys,
}  
}  i have attached qmpri.erl which implements priority message processing using
}  time-outs. same problem here is that the spawned process exits/dies quietly,
}  pman seems to indicate a badarg situation - but that is not getting thrown
}  to console.
}  
}  1. c(qmpri).
}  2. Qm=qmpri:start([1,2,3,4]).
}  3. qmpri:testdeq(Qm). % this just waits because pid=Qm has vanished
}  
}  can you advise on why qmpri:qm/1 is quitting out of infinite recursion in
}  the absence of a stop message?
}  
}  cheers
}  sameer



More information about the erlang-questions mailing list