panel clock (kclockapplet) patch

Ryan Cumming ryan at kde.org
Wed Nov 6 21:50:09 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On November 6, 2002 13:34, Helge Deller wrote:
>
> This patch seems to work somewhat more correct and includes changes as
> suggested in feedback by Melchior.
>
> Comments ?

Could you explain this code:
int ClockSettings::calc_TZ_offset(const QString& zone)
{
  static int lock = 0; /* a very simple lock algoritm */
  
  while (lock)
	/* wait */;

  lock++;

  <do stuff>
 
  lock--;

  return diff;
}

?
If you're trying to protect from multiple entrances from a single thread, the 
second time you enter the function, the program will just get stuck in an 
infinite loop. If you're trying to protect from multiple entrances from 
multiple threads, that code is -not- thread safe.

- -Ryan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE9yY6VLGMzRzbJfbQRAucSAJ4wqHFV7QATWxz2LZGr5NUG6x7uWACeOblC
+95mJ6UN+X1nSyHgyodpVMw=
=UpnQ
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list