• Advertisement

Cat's machete

Member
  • Content count

    899
  • Joined

  • Last visited

Community Reputation

1451 Excellent

About Cat's machete

  • Rank
    >^_^<

Personal Information

  1. additionally I guess your app window has the size of the screen, depending on depth test enabled fragment shaders kill your framerate
  2. C++ Strange behavior with extern definition

    Im using c4droid compiler for android i may not use some compulation settings and i use include cpp thing thus i use there header guard too so no worries
  3. C++ Strange behavior with extern definition

    Yeah it seems i need to include cpp not h file.
  4. I need to use global vars, So say i have main.cpp file where i #include "globalvars.h" In globalvars.h i define extern int ppp; In globalvars.cpp i put #include "globalvars.h" int ppp; Now in main cpp during compilation i get UNDEFINED REFERENCE TO ppp
  5. Guess i use select to find whenever one peer fd is ready for some action, as far as i understand sockets whenevrr client sends some packet and read func returns end of file that means that server received a packet from a client, now what about when client send two packrts one after another, does select will return ready for that client to process first packet and after calling select again (and read) will it make the same client filedescriptor ready to receive that second one?
  6. Guess i have a thread and im on main thread of app now i would like to wait until thread finishes to execute. Thread Func void ProcessServerFrame() { server_thread_free = false; while (!server_thread_finished) Do stuff server_thread_free = true; } And then from main thread i would like to check whenever thread finished to work void CreateDWMTCPServer() { if (server != 0) { server_thread_finished = true; while (!server_thread_free) {} delete server; server = 0; } } Now i am not sure if thread is allowed to read data when other is writing to it or maybe theres some kind of queue that prevents that from happening, basically i dont want to check for server_thread_free when thread marks it as true any thoughts?
  7. Collision response and change in force

    You need to define yourself how much force the hit will consume.
  8. initialize std::thread

    That is not going to happen, sorry
  9. initialize std::thread

    i have read cpp reference more carefully and found that detach does not kill the thread but makes it independent from creator thread, so this is my saint graal Detaches the thread represented by the object from the calling thread, allowing them to execute independently from each other. Both threads continue without blocking nor synchronizing in any way. Note that when either one ends execution, its resources are released. After a call to this function, the thread object becomes non-joinable and can be destroyed safely. jeez i almost threw all my phones down the river ;p
  10. initialize std::thread

    this is why i do this: TTCPWindowLayerServer * srvtcp = new TTCPWindowLayerServer(); srvtcp->CreateServer(0); i dont want to call join cause i don't want the main thread to be paused at all, however it may seem that android automatically crashes my app, since i think it thinks the UI Thread is being suspended, thus how is this even possible, when i spawn a thread so it shouldnt matter from which place i spawn it, it should independly even when im creating server class in that ui thread, but if it is so, then i just grab my pc and throw it into river. looks like you cant stall ui thread with some standard function even for 20 seconds, but you cant stall it with a thread for even a microsecond., and my app base is always dependnt on ui thread since i call onTap(x, y) from java to execute cpp code..... either i thro pc and phones to the river or make a bypass by using join and somehow proceed with stalled threads. giving up seems easier
  11. initialize std::thread

    funniest thing is whenever i add ListenThread.join(); and create exit condition so thread actually quits it doesnt crash anything.
  12. initialize std::thread

    yeah i just went here to write the same thing i figoured that out myself thanks man listen_and_accept_finished = false; std::thread ListenThread(&TTCPWindowLayerServer::ListenAndAccept, this); however using your code or mine makes my app to crash theres an int i increment each time thread loop executes void ListenAndAccept() { while (!listen_and_accept_finished) { Port = Port + 1; continue; } } and it just crashes after few iterations i dont even use int Port; anywhere else except during class constructor to define it as 0 listen_and_accept_finished isnt used anywhere else than in this loop too i get Fatal signal 6 (SIGABRT) it may seem that android doesnt like threads...
  13. How can i create a thread that executes a function (void) in a class, cause void foo() {} int main() { std::thread first (foo); } works but struct TTCPServer { void foo() {} void CreateThread() { std::thread first (foo); } }; doesnt even compile
  14. sys/socket.h and std::thread (C__)

    listen() is usually not blocking. (ah usually ;x) Also, you only call listen() once, to specify the backlog (queue) size and mark the socket as listening. im asking because according to this: http://www.linuxhowtos.org/data/6/server.c when listen is called it seems its blocking main thread and waits for connections. Thats why im asking. so actually i must call listen once and call repeatedly accept() in a thread. - thats what i wanted to know, however its time to run tests, anyway i couldnt find any info if listen actually holds the thread or not so either it does or not, usually doesnt seem to be a an answer, i need something that either blocks or not ;]
  • Advertisement