[ale] Help with C project

Christopher Hagler haglerchristopher at gmail.com
Sat Jan 23 11:52:47 EST 2016


I am working on a home automation project written in C. It allows a user to
automate daily task with open source hardware and software. However, since
I am lacking experience with pthreads, I have run into a couple of issues
that I cant seem to resolve. The intentions of the code where the issues
reside are:

The project allows drivers to be written as shared objects that, which in
turn, will control a remote hardware device or devices with all
communication happening through shared memory. The Scheduler module will
take the shared object, and schedule it to run via process queues. Once the
process, a struct containing the shared object and an abstraction for a
pthread, runs for its time slot, the scheduler will stop the process and
place it in another process queue. The whole idea was to simulate an
operating system scheduler because potentially there could be a few hundred
threads. This is where the first issue resides. I am having trouble putting
the process to sleep. I have done some research on pthreads and supposedly
this can be accomplished via pthread condition variables. This is the
solution I have attempted, and apparently I have not implemented it
correctly. It will start the process which will run, but when I try to put
it to sleep, it keeps running.

The second issue is when ever you run the program, it fails to link the
shared object sometimes. However, if you have to quickly run the program
back-to-back, it will start and run fine. I am not sure why this is
happening. It could possibly be linked to my setup, but I am not sure. I am
running Opensuse in Virtual Box.

Any advice on these issues would be greatly appreciated. I also know there
are a couple of people who have been wanting to learn C, and you are more
than welcome to join the project if you want.

The code base:
https://github.com/haglerchristopher/automation/tree/development

Thanks for the help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20160123/f2cdae81/attachment.html>


More information about the Ale mailing list