Author Topic: No Need For Locking?  (Read 7384 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
No Need For Locking?
« on: January 09, 2009, 12:39:24 PM »
Hi Mark,
  I was going to make sure I am right, before I continue. I have a routine that is called from the serial,USB and ethernet task, so at any stage, one of these tasks can call this routine. I must make sure that one task doesnt call the routine when another task is already in it.  I was going to place a variable lock at the start of the routine,so each task has to wait till its free before continuing.

But, am I right in saying, a task has to complete before another one gets control? And as this routine is only called from a task, and not an interupt directly, then there is no need for the lock?

Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: No Need For Locking?
« Reply #1 on: January 09, 2009, 12:45:30 PM »
Hi Neil

This is correct. Only interrupts need to be considered, whereas the uTasker OS/driver routines and interrupts are fully protected. Therefore you only need to really worry about your own interrupts which may be interacting with your own code's variable.

Regards

Mark