08-19-2013, 08:54 PM
So today I tested the cWorld::DoExplosiontAt function with the cLineBlockTracer. This is the result:
Random Chitchat 2012-2016
|
08-19-2013, 08:54 PM
So today I tested the cWorld::DoExplosiontAt function with the cLineBlockTracer. This is the result:
Thanks given by: xoft
08-19-2013, 09:16 PM
Cool!
08-19-2013, 10:22 PM
I knew there would be cool stuff
Now make it animate in time - napalm thrower
I'm having trouble with Linux's sem_timedwait() function. For some reason it returns a "timeout" immediately after being called with a 0.5sec timeout. Therefore the DeadlockDetect thread misfires on Linux.
Does anyone have any experience with this? For those of you with Linux, can you compile and run this quick test program? #include <time.h> #include <stdlib.h> #include <stdio.h> #include <semaphore.h> #include <errno.h> int main(void) { sem_t sem; if (sem_init(&sem, 0, 0)) { printf("sem_init failed\n"); return 1; } timespec timeout; timeout.tv_sec = 1; timeout.tv_nsec = 500 * 1000 * 1000; clock_t Begin = clock(); int res = sem_timedwait(&sem, &timeout); clock_t End = clock(); printf("sem_timedwait: %d, errno %d, %llu ticks\n", res, errno, (long long)(End - Begin)); sem_destroy(&sem); return 0; }Compile with (assuming test.cpp is the filename): Code: g++ test.cpp -lpthread When run, it should print something like Code: sem_timedwait: -1, errno 110, 0 ticks
I get the same as you.
Are the set and nsec values supposed to be different like they are? 110 seems to indicate that it timed out locking the thing. but idk.
08-20-2013, 01:20 AM
It is expected to time out, because no-one is signalling the semaphore, but it is expected to time out after the specified timeout value, which in this case is 1.5 sec (1 sec + 500M nsec). For some reason it "timeouts" immediately.
08-20-2013, 01:24 AM
Why not try signalling it and see if it works then?
08-20-2013, 02:09 AM
Oh, duh! So stupid, didn't read the docs. The timeout is specifiead absolute, not relative, so it needs to be set to time(NULL) + nsec
08-20-2013, 03:45 AM
Derp. Great that you got it working then.
Still, some weirdness going on. The test program stops correctly for the 1.5 sec, but still reports 0 ticks. Anyway, it's good enough for me now; I have more pressing issues:
1, Pickups 2, Hunger It seems that PerWorldThreads has brought in a lot of unexpected resource contention; the current debugging version is no longer capable of running the world tick thread, not even for a single player. The release version is doing better, but still I need to fix this, because we can't do much without the debugging version. |
« Next Oldest | Next Newest »
|