1
System / Thread creation starts to fail.
« on: June 07, 2011, 03:27:31 pm »
ulimit -u returns 1024. Well maybe i have to use less threads then.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#include <iostream>
#include <SFML/System.hpp>
void thread_one(int* counter) {
for(int i = 5; i < 100; i++) {
sf::Sleep(500);
}
}
void thread_two(int* counter) {
for(int i = 5; i < 100; i++) {
sf::Sleep(500);
}
}
int main() {
int counter = 2;
while(true) {
sf::Sleep(1000);
sf::Thread * threadOne = new sf::Thread(&thread_one, &counter);
sf::Thread * threadTwo = new sf::Thread(&thread_two, &counter);
threadOne->Launch();
threadTwo->Launch();
std::cout << "Two threads launched!" << counter << std::endl;
counter += 2;
}
}
I looked a little at sf::Network and some other low-level networking libraries recently. I think I might choose enet since it doesnt require threads and makes it easy to send reliable packets.
I've never done netowork programming before and so it seems really interesting and challenging. It's almost like a new way of thinking. However every time I think about it I get scared because of all the issues that can occur (high lag, cheating, synchronisation problems). Perhaps I should try to get a basic system working and worry about those later.
Have you made any networked apps before? Is it really as hard as I think it is?QuoteSurvived 7 rounds with touchpad on my laptop ran out of bullets
Wow must be hard on a touchpad. You can buy more ammo from where you bought your gun. I'm guessing you ran out of mp5 ammo