DragonFly kernel List (threaded) for 2008-05
DragonFly BSD
DragonFly kernel List (threaded) for 2008-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

kthread_create and rel_mplock


From: Michael Neumann <mneumann@xxxxxxxx>
Date: Sun, 18 May 2008 19:55:26 +0200

Hi,

If I understand the kthread_create correctly, it will always acquire the
mplock (something like a global lock). That means, if I create two
threads, they will automatically be serialized (i.e. run sequentially),
unless I release the lock within a thread manually. Is that correct?

Does that mean that I can remove the mtx_lock in the FreeBSD example
below:

      void
      usb_task_thread(void *arg)
      {
             mtx_lock(&Giant);
             // ....
             kproc_exit(0);
      }

kthread_create(..., usb_task_thread);

Is mtx_lock(&Giant) equivalent to the mplock on DragonFly?
My understanding is that it is equivalent, and that I don't need any
further critical sections.

Regards,

Michael



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]