Mark function to be used only under lock

112 Views Asked by At

I'm writing a linux kernel driver and I have a function which MUST be called under lock, and I want to make sure no one will use it without acquiring the lock. This function is called many times from different functions which acquire the lock prior to calling the function.

I'm wondering if there is a way of telling the compiler to verify that all calls to that function are done under a lock? something like function attributes or something similar.

thanks.

0

There are 0 best solutions below