Posts: 44
Joined: Mon Sep 03, 2018 3:45 pm
Contact: Website Skype

vcos_sempahore vs posix semaphore

Thu Sep 13, 2018 10:03 am

I don't know if is the right section where ask. I see on the mmal example code that are used vcos_semaphore: why don't use posix (http://www.csc.villanova.edu/~mdamian/t ... ixsem.html)? Or vcos sempahore are just a wrapper of posix sem?

Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7259
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: vcos_sempahore vs posix semaphore

Thu Sep 13, 2018 11:13 am

vcos is an operating system abstraction. (VideoCore Operating System) See https://github.com/raspberrypi/userland ... rface/vcos for the full source of vcos.
In the case of vcos_semaphore_create on pthreads, see https://github.com/raspberrypi/userland ... orm.h#L324

It allows the resulting code to be run on a variety of operating systems, including pthreads, ThreadX, Symbian, Windows, and Nucleus. Back in Broadcom there were a number of test apps that would run on a number of those operating systems without modification, which makes cross platform regression testing significantly easier.
MMAL code in particular shares a significant proportion of the core code between the host OS (typically pthreads for the Pi) and ThreadX for the VPU, hence the need for an OS independent abstraction.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Graphics programming”