Hi amejoish,
nice try, now in stage1 fn send some data in buffer1 after closing the directory (like "No more files") and in stage2 fn break the loop whenever u get this line. Be careful that all ur locks are removed correctly before coming out of loop.
All the best...
Additionally i added sleep funtion , am delayin both the threads for random no of time and its working exactly the way i want it.
Now am implementing next 2 stages
stage3: read lines from file and store in buffer
stage4: find a substr in the line and then store that line in buffer2
even in this case after introducing sleep function , the output is proper. But whats weird is am facing race conditn even after using mutexes.
Check the output:
if u see the stage 3 has inserted buffer[3](in=3) = asdgetg but the out pointer used by stage4
buffer[3] (i.e out =3) value is adgrg which is weird. Increasing the delay time for thread 1 somehow fixes the problem.
If i dont use the sleep then output is entirely messed up.
Can you please explain this concept or how come not delaying threads messes up the output
Check the pointer concepts once.
Here you are creating a pointer to pointer, which can hold the address of a char pointer, later you are copying the data into str
and storing str address in respective location.
So, buffer3[in] will hold the addr of str everytime and you are changing the data in it everytime.
Could you please give your inputs on the below issue:
source.xml
<?xml version="1.0" encoding="UTF-16"?>
<P1 >
<C1 type="i"><2></C1>
<V1 type="string"><6.2></V1>
<D1 type="string">
<D2><1.0></D2>
<D2><2.0></D2>
</D1>
......................
......................
many more... (7 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
My problem is that when creating my producers and consumers, if I don't create an equal number of both, the... (12 Replies)
Hi everybody,
i've been googling for ages now and gotten kinda desperate... The question, however, might be rather trivial for the experts: What is it exactly, i.e. physically, the POSIX function (for a file) "lseek" does? Does it trigger some kind of synchronization on disk? Is it just for the... (4 Replies)
Hi
I'm trying to implement CAPWAP protocol for my application.i'm able to configure my server side but i'm getting error at client(WTP) side as IOCTL error.while running the command
#./WTP /mnt/cf/capwap/
: wlan2
Starting WTP...
# WTP Loads... (0 Replies)
Hey Guys
Some of my friends have got together and we are trying to write a basic kernel similar to Linux. I am trying to implement the malloc function in C and I am using a doubly linked list as the primary data structure. I need to allocate memory for this link list (duh...) and I don't feel... (2 Replies)
Hey Guys
I am trying to implement the malloc function for my OS class and I am having a little trouble with it. I would be really grateful if I could get some hints on this problem.
So I am using a doubly-linked list as my data structure and I have to allocate memory for it (duh...). The... (1 Reply)
Hi,
I am accepting a string from user. compare this output with the awk output as below...
echo "\n\n\tDay : \c"
read day
awk '{ if($day == $2) { if ($mon == $1) { print "Yes" }}}' syslog.txt
I am getting the follwoing error
awk: Field $() is not correct.
The input line... (5 Replies)
At present, Iam working on Linux Framebuffer device console. I have a doubt sir. Please solve this.
*How to display a string or a character in Frame buffer in C language?
*What is the library file (is it <linux/fb.h> or other one?) used to do all I/O function manipulations like printing,... (0 Replies)