• Welcome to Valhalla Legends Archive.
 

bncsutil bug with -lpthread

Started by aton, July 16, 2008, 08:28 AM

Previous topic - Next topic

aton

hi,

i am developing bnet stuff for linux. bncsutil works fine, thanks to whoever works on it!

for those who are interested:

yesterday i added some threading functions to my code and linked against the pthread library.

after that kd_create failed all the time, i did some research and saw that kd_lock_decoders() fails, i.e. this code:


int err = 0;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
struct timespec wait_time = {0, MUTEX_TIMEOUT_MS * 1000};

err = pthread_cond_timedwait(&cond, &mutex, &wait_time);


pthread_cond_timedwait returns nonzero which causes the bug.

i am now using fork() instead of threads, though its a bit inconvenient.


greetings, aton

K

I suggest you call perror if the call returns non-zero to get an idea why it's failing.  (or if you cant print from that context, use strerror(errno) to get the error string).