I try to build some producer-consumer application in tbb. Earlier I use WaitForSingleObject and Release semaphore function from windows api to synchronization threads. My question is how I can synchronize tbb tasks with mutex and lock?
Is this possible at all? Or there is some other techniquefor this...
The idea is that you should express all blocking dependencies (excluding predictably short waits) as parent-child relationships between tasks and let the task scheduler figure them out. Otherwise the task scheduler will not know what is going on and leave a hardware thread otherwise unused while the software thread that should be running on it is blocked waiting. If you do have such requirements, the most straightforward approach is to do those things outside of TBB in a dedicated thread (despite the name, tbb::tbb_thread is merely an API to such a thread). But feel free to experiment: it's not always black or white.
(Added) Relating to the title of this thread, "Mutex question": those would be the predictably short waits that I mentioned, for which TBB provides several types of mutexes.
Read the chapters about the Task Scheduler in the Tutorial and the Reference Manual. Broadly speaking, a parent task becomes eligible for execution only when its children have finished, so expressing dependencies that way is a natural fit for the scheduler.