Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C (http://www.programmingforums.org/forum60.html)
-   -   Help with Semaphore implementation (http://www.programmingforums.org/showthread.php?t=12424)

sonu2die4 Jan 22nd, 2007 11:20 PM

Help with Semaphore implementation
 
Hello ,
I am a newbee and I want to implement a semaphore which will do the

following :
4 threads want to do a printf .
Thread A ----> print A
Thread B -----> print B
Thread C ----> print C
thread C-----> print D
and the output must be ABCD.
How to do this on a Borlad TC 3.0 running on a windows machine?
Thank You
Sonu

jim mcnamara Jan 24th, 2007 5:55 PM

1. Borland TC 3.0 does not support threads or memory sharing.

2. If you must do this with TC 3.0 use a "lock" file as a sempahore-like object.

3. TC 3.0 is a DOS compiler. DOS does not handle threads or context switching at all. It supports TSR's. I have no idea how you would run four processes and have them all execute in the same timespace. 4 TSR's?
How would you schedule the TSR's?

There are LOTS of free compilers - google for "C compiler download"
Unless you are locked into an old 286 machine that can't do Windows.

sonu2die4 Jan 24th, 2007 6:12 PM

Hi ,
Thank You very Much. It will be of very great help if you can just give me a brief idea of the code...so that i may run it on the linux...i have just loaded the linux on my system...so I will be able to do it there...however I want to get just a fail idea of the code in c
Regards
Vivek


All times are GMT -5. The time now is 1:41 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC