IPC: Fix a race condition in MessageQCopy initialization
authorJuan Gutierrez <jgutierrez@ti.com>
Wed, 28 Mar 2012 00:22:01 +0000 (18:22 -0600)
committerSuman Anna <s-anna@ti.com>
Fri, 27 Apr 2012 21:38:25 +0000 (16:38 -0500)
commitf0162b15ae43f7ab8fd5e6aa83327de1cd5230b9
tree745d45fb2ad092192a023db22efa9b4b464bd5e3
parent3ab7d17a9c2f8f4088129e2a76f4c8d143103ac4
IPC: Fix a race condition in MessageQCopy initialization

When a task called MessageQCopy_init function, it immediately
set the curInit variable to true before starting the actual
initialization. If another task called the same function, the
curInit was true already, and proceeded as if the initialization
was already done, while the module is still being initialized.

A semaphore initialized with its count to 1 is used as a mutual
exclusion protection between the competing tasks.

Signed-off-by: Paul Hunt <hunt@ti.com>
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
src/ti/ipc/rpmsg/MessageQCopy.c
src/ti/ipc/rpmsg/package.xs