Admittedly, this has only been reported by one PU user,
http://wcjunction.com/phpBB2/viewtopic.php?p=7010#7010
but just in case it might actually be a vegastrike bug...
Started with the new engine as of a week or two ago, and continues with yesterday's exe release.
This user has the same problem when playing the latest vegastrike svn.
Only way for him to get rid of vegastrike.exe is to 3-finger it.
He's updated XP to SP2, got all the latest drivers. Only suspicious hardware
thing I can think of is he only has 512 megs of ram, and we're not using
dds compression yet.
Bug report: exe locking up on quit
Moderator: Mod Contributor
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Bug report: exe locking up on quit
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
In case it was related to the second music thread (that's the only thread, so the only thing I could imagine causing it to stay running).
So this is the code to kill the thread.
I don't see any good reason for this to cause a problem unless the thread is unresponsive...
The other possibility is that it was loading a song, took more than 5 seconds to do so, and then the Music class got free'd, and then the other thread kept by chance reading a "0" for killthread so stayed alive indefinitely, keeping the whole program in memory.
I don't have very much experience with threads, but do you know how to improve the safety of this loop?
I also think there was a reason I commented out the pthread_kill code, but perhaps that would work as a last resort?
Or should I increase the spinning counter to 10 or 30 seconds?\
Code: Select all
Music::~Music()
{
if (threadalive&&thread_initialized) {
killthread=1;
#ifdef _WIN32
ReleaseMutex(musicinfo_mutex);
#else
checkerr(pthread_mutex_unlock(&musicinfo_mutex));
#endif
int spindown = 50; // Thread has 5 seconds to close down.
while (threadalive&&(spindown-- > 0)) micro_sleep(100000);
if (threadalive) {
/*
// The thread should be dead to make exiting easier...
#ifdef _WIN32
TerminateThread(a_thread, 1);
#else
// Taking its time to load a song...
pthread_kill(a_thread, SIGKILL);
#endif
*/
threadalive=false;
}
}
// Kill the thread.
}
I don't see any good reason for this to cause a problem unless the thread is unresponsive...
The other possibility is that it was loading a song, took more than 5 seconds to do so, and then the Music class got free'd, and then the other thread kept by chance reading a "0" for killthread so stayed alive indefinitely, keeping the whole program in memory.
I don't have very much experience with threads, but do you know how to improve the safety of this loop?
I also think there was a reason I commented out the pthread_kill code, but perhaps that would work as a last resort?
Or should I increase the spinning counter to 10 or 30 seconds?\
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
I've read a lot of articles about multithreading, so I know some stuff in the abstract. But my only practical multithreaded programming experience was when I coded a per-thread allocator using boost::thread, though. I recommended this to safemode last week, and he can vouch for how easy they are to use. And the library is portable, so you'd get to keep those #ifdef's out of your code.
But so, I don't understand the code you posted, because I never did any direct coding of threads.
Just idiot questions:
1) What happens if the thread is live but not initialized?
2) 5 seconds may indeed not be enough; Anscar reports that the music stays on for about 20 seconds after he quits.
3) It maybe that the music thread never gets the message as it may be blocked looking at some soundcard bit. Anscar has an Audigy. I had all kinds of trouble when I used to have an Audigy.
4) An audio thread being unresponsive kind of makes sense. First of all, threads are not multithreaded , and a sound thread might sometimes get wrapped up with the hardware.
http://www.l.google.com/search?q=audigy ... =firefox-a
But so, I don't understand the code you posted, because I never did any direct coding of threads.
Just idiot questions:
1) What happens if the thread is live but not initialized?
2) 5 seconds may indeed not be enough; Anscar reports that the music stays on for about 20 seconds after he quits.
3) It maybe that the music thread never gets the message as it may be blocked looking at some soundcard bit. Anscar has an Audigy. I had all kinds of trouble when I used to have an Audigy.
4) An audio thread being unresponsive kind of makes sense. First of all, threads are not multithreaded , and a sound thread might sometimes get wrapped up with the hardware.
http://www.l.google.com/search?q=audigy ... =firefox-a
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
I don't like directly coding threads either... this was added as a quick fix to prevent a 10 second complete freeze when switching tracks.
The thread code I pointed out was only the loader thread. It is not responsible for playing the music, so the fact that music keeps playing for another 20 minutes is in fact pretty strange. That might mean that OpenAL or a driver is the source of the problem.
Is he the only person with this problem?
SO I suppose I can for now increase that number from 5 to 10? Should I also do a pthread_kill so that at least the thread won't freeze up? Or is pthread_kill too dangerous?
The thread code I pointed out was only the loader thread. It is not responsible for playing the music, so the fact that music keeps playing for another 20 minutes is in fact pretty strange. That might mean that OpenAL or a driver is the source of the problem.
Is he the only person with this problem?
SO I suppose I can for now increase that number from 5 to 10? Should I also do a pthread_kill so that at least the thread won't freeze up? Or is pthread_kill too dangerous?
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
20 secondsace123 wrote:so the fact that music keeps playing for another 20 minutes
He supposedly upgraded XP to SP2 and updated his drivers. But I remember when I had an audigy that finding the right driver for it at creative downloads was as easy as winning nethack.is in fact pretty strange. That might mean that OpenAL or a driver is the source of the problem.
Yes he is, and he has the same problem playing vegastrike svn.Is he the only person with this problem?
or to 30, to be > 20 seconds, perhaps.SO I suppose I can for now increase that number from 5 to 10?
He's on windows; can't be more dangerous than having to 3-finger the app...Should I also do a pthread_kill so that at least the thread won't freeze up? Or is pthread_kill too dangerous?
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.