Hi,

2009-06-15 20:44 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
  * include/hbextern.ch
  * source/vm/thread.c
    + Added HB_MUTEXWAITERSCOUNT() to core.
      (slightly rewritten using local functions)

Such function by definition cannot return valid result so it should
be marked as helper function with intentional race condition inside.

I know that thread count could be changed between HB_MUTEXWAITERSCOUNT() and actual HB_THREADSTART(), but I do not care a lot about it. But it would be bad if this race condition can cause return garbage on some systems. In this case it need to be protected by mutex. It could be renamed to __MUTEX*() of couse, but I feel, that sometimes it could be useful to have mutex information function. I found two things useful: waiters count and queue length. Maybe we can create some more general mutex protected function like:
   HB_MUTEXQUEUEINFO( hMutex, [ @nWaitersCount ], [ @nQueueLength ] )
or another name similar name.

Przemek, I think your opinion is most valuable here. Or maybe you propose a completely different problem solution. The problem is worker threads count management: if too many workers are free, it would be good to decrease workers count; if job queue length is too big, it would be good to start new worker threads.


Regards,
Mindaugas
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to