$Id$
+Mon Nov 28 10:45:21 EST 2005 ajc
+* control.c: fixed a potential concurrency/race condition in
+ the get_new_[message|room|user]_number() functions.
+
Sun Nov 27 21:20:27 EST 2005 ajc
* Eliminated the use of tmpnam() to shut up the compiler warnings.
*/
long get_new_message_number(void)
{
+ long retval = 0L;
begin_critical_section(S_CONTROL);
get_control();
- ++CitControl.MMhighest;
+ retval = ++CitControl.MMhighest;
put_control();
end_critical_section(S_CONTROL);
- return (CitControl.MMhighest);
+ return(retval);
}
*/
long get_new_user_number(void)
{
+ long retval = 0L;
begin_critical_section(S_CONTROL);
get_control();
- ++CitControl.MMnextuser;
+ retval = ++CitControl.MMnextuser;
put_control();
end_critical_section(S_CONTROL);
- return (CitControl.MMnextuser);
+ return(retval);
}
*/
long get_new_room_number(void)
{
+ long retval = 0L;
begin_critical_section(S_CONTROL);
get_control();
- ++CitControl.MMnextroom;
+ retval = ++CitControl.MMnextroom;
put_control();
end_critical_section(S_CONTROL);
- return (CitControl.MMnextroom);
+ return(retval);
}