Archived

This topic is now archived and is closed to further replies.

Program crashes abruptly

This topic is 5655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''ve reread my code a billion times now and I can''t figure out what happens. I''m writing a simple program for music playback, running two simultaneous threads, one for prebuffering and reading from a source, the other one for playback. What happens is that at any random moment the pragram may crash. The crash is complete in the sense that everything related to the program is terminated, no error messages are thrown etc. I''m not used to debugging a program without ANY clue as to what''s wrong. The strange thing is that it is totally capable of finishing playback without a hitch then, when run again, however, it may terminate just half a second after playback has begun. I tried using the integrated debugger in my BC5.02. I don''t know any asm, so it doesn''t help me much, though... Does anybody have experience as to what may cause such a sudden crash (the amount of code''s grown quite big by now so maybe I''m just missing a simple thing...)? Thanks, Crispy

Share this post


Link to post
Share on other sites
quote:
Original post by hpotter2
Could you post the code?


I''d rather wait with that - I''m playing the files via a dll plugin and there''s quite a bit of it (code) for posting on a forum.

quote:
Original post by Michalson
How are the two threads interacting?


Here''s the general idea of how things work:

1) A thread is created for syncing streams (stream is an independent class which is marked as ACTIVE or INACTIVE)
2) A number of streams are created and registerd in the syncing class which then starts calling FillPreBuffer() from the dll for each stream, if the stream is ACTIVE. Each stream has 2 or more prebuffers. The next prebuffer (in a "rotating fashion") is filled if the previous one is "depleted" (data was taken from it for the last time, incrementing its offset to the prebuffer size and setting its status to REDUNDANT).
3) A playback thread is run which starts calling ReadChunk() from the dll which returns a chunk from the active prebuffer and increases the offset indicator withing it
4) This is continued until playback is stopped or data runs out

The bottom line is: the two threads do not interact, but they form a crossdependent cycle. I''ve tested it thoroughly and I''m pretty sure that the threads work well and data is always present. So it seems very unlikely that the threads have anything to do with the crashing.

Crispy

Share this post


Link to post
Share on other sites