F
facugaich
Hi, I have some questions regarding a multithreaded server I'm working
on.
Since the main function (the primary thread) and the handle_client
function (called by all the other threads) use the user database
variables (pointer to array of struct, file, number of users) and to
the handle_function I can only pass a void* (currently a pointer to a
struct with client data), I have declared the user database variables
as global. Do you think they're justified in this case?
Also, I'm an intermediate (I think) C programmer and so far in
everything I have read, I find situations where the code is correct but
it could be rewritten with lots of changes to avoid bugs, better
portability, etc. These details are never mentioned in tutorials (sadly
I can't afford a book) so maybe I was thinking I could post the code of
my current work and get some advice. It has 480 lines, documented,
would it be ok to post it in here? If not, do you know any place I
could do so? If also no, what advice would you give me for the issue?
Thanks in advance.
on.
Since the main function (the primary thread) and the handle_client
function (called by all the other threads) use the user database
variables (pointer to array of struct, file, number of users) and to
the handle_function I can only pass a void* (currently a pointer to a
struct with client data), I have declared the user database variables
as global. Do you think they're justified in this case?
Also, I'm an intermediate (I think) C programmer and so far in
everything I have read, I find situations where the code is correct but
it could be rewritten with lots of changes to avoid bugs, better
portability, etc. These details are never mentioned in tutorials (sadly
I can't afford a book) so maybe I was thinking I could post the code of
my current work and get some advice. It has 480 lines, documented,
would it be ok to post it in here? If not, do you know any place I
could do so? If also no, what advice would you give me for the issue?
Thanks in advance.