Is it a real code? But here U dont check for pthread_create return code.
for(;; ) ???
Did U try to create only 32 as declared above?
Possible error for pthread_create is only EAGAIN, which means no more system resources available,
ofcourse if U write for(;; ) and try to create unbounded count of threads.
"UNIX is simple; it just takes a genius to understand its simplicity!"
[EAGAIN]
The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process PTHREAD_THREADS_MAX would be exceeded.
[EINVAL]
The value specified by attr is invalid.
[EPERM]
The caller does not have appropriate permission to set the required scheduling parameters or scheduling policy.
The pthread_create() function will not return an error code of [EINTR].
Last edited by malletelf; February 12th, 2003 at 05:11 AM.
I compiled your server, run it, then with telnet opened a connection. So all was OK! No any error with pthread_create(). perror gave "Invalid seek" for pthread_attr_setscope(). Why do U use it? This default value for posix linux threads, as I remember, or U use another UNIX?
So for some time it works until telnet breaked it. I put printf() into Client() - function and it worked.
So I hadn't error with pthread_create().
"UNIX is simple; it just takes a genius to understand its simplicity!"
I didn't work with Spark platform and SunOS. This is very simple sample U 've provided. And quike view didn't recognise any problems with network part. Of course, it has it, but they cannot make problem U have.
So I don't know, may be it depends of Sun posix realization or something else.
Did U try this without pthread_attr_setscope()?
Else why fork()? U create a child process, then create thread in it, but then after a little a child process is ended and thread U created too.
It is enough to call pthread_create() to create a client thread.
Last edited by dimm_coder; February 13th, 2003 at 03:08 AM.
"UNIX is simple; it just takes a genius to understand its simplicity!"
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.