|
Thanks, but the program isn't meant to do anything productive, it's just to show the need for synchronization.
The timing test was just a test to find out what to expect when I run my multithreading applications on a dual-core machine and I was quite surprised that the test doesn't run as fast on a dual-core as it would on a single core...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Locking a static object mite help...
|
|
|
|
|
Thanks, leppie, I'll try this.
Initially I had 2 objects for locking (non-static), one for each loop.
Then I locked both loops with the same object and then with this .
The strange thing was that using 2 objects also slowed down the program, while using a single locking object or this yielded equal (and better) results.
I'll post an update here as soon as I tried the static object for locking...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi!
The update I promised earlier:
Using a static object vs. an instance object doesn't show any difference.
Still letting the application run on both cores is slower than when limiting it to just one core...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
You are probaby not doing enough work per thread to justify multi threading it. IOW the lock construct is alot more expensive than say an increment statement.
|
|
|
|
|
Could be, yes. I'll try adding a little workload to the locked area...
Thanks,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Final update:
You were right. As soon as I let the critical section perform something more demanding the execution times with 2 cores became better than with just one core.
I was really starting to get worried, you know?
Thanks!
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello Every 1, I have a problem where I have to pass a delegate as a parameter to a Method Call (method is simply a caller for an API method). I have decelared and initilized the delegate globally, given it my own method that should be called. I even assigned the delegate to the GCHandle and Pinned it (GCHanle.KeepAlive(....))
Now the problem the delegate is called as a parameter in a method call
The delgate signature is
public delegate void delegateCallBackFunction(); (global 4 namespace)<br />
<br />
public delegateCallBackFunction CallBackFunction; (global 4 class)
..............Now the function where the delgate is called........
public bool wrg303_CodecStart(int hRadio, FileStream ifFileStream, GCHandle targetHandle)<br />
{<br />
ifFileWriter = new StreamWriter(CallbackContextObject.ccifFile);<br />
bool status = true; <br />
status = (CodecStart(hRadio, CallBackFunction(GCHandle.ToIntPtr( targetHandle)),GCHandle.ToIntPtr( targetHandle)));<br />
return status; <br />
targetHandle)));<br />
}
If i use this code the error is that The second parameter is void where it should be a delegate.
I can't use new delegateCallBackFunction(.....)
How the hell I am going to pass the delegate as a prameter.
Thanks
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
Hello
Your code is a bit mixed up. You should have posted the prototype of CodecStart() and CallBackFunction() functions. Anyway, I've revised the sample code in MSDN writen in the GCHandle class example. Did you revise it?
Also you gave targetHandle twice, to the API and to your method, why?
Also Why can't you use new delegateCallBackFunction??
Regards
|
|
|
|
|
hello, How can i let the web page to be updated automatically every 10 seconds without forcing the user to press F5 or click refresh button.
I want it as you can see on the gmail page
Thanks alot
Hamody
|
|
|
|
|
or
Or use one as a backup for the other, at 15 seconds or so.
-- modified at 10:10 Sunday 27th August, 2006
---
b { font-weight: normal; }
|
|
|
|
|
hi, thanks a lot for your reply,...
may u tell me please how i can use the code the u replied me, and where i have to put it??
Thanks alot
Hamody
|
|
|
|
|
The meta tag goes inside the head tag.
The body tag, well... where do think that goes?
---
b { font-weight: normal; }
|
|
|
|
|
man, it comes step by step ...
thanks a lot ... it is done now
Thanks alot
Hamody
|
|
|
|
|
hi all,
I'm using VS.net2005 C#,
I've class inherited from System.Windows.Forms.Button named PanelButton and FlatStyle is Flat, in run time when the PanelButton foucsed there is a rectangle displayed in the middle of button, i want to hide this rectangle..is it possible?
plz i need any one have an idea to help me.
thank you
-- modified at 5:11 Sunday 27th August, 2006
|
|
|
|
|
Hello
Yes of course in many ways..
The simplest one is to handle the paint event, and draw another rectangle over this one using the BackColor of your button. This should hide it.
Regards
|
|
|
|
|
hello,
this may help if the button have a back color, but what can i do if the back color of the button is transparent?
thank you
|
|
|
|
|
Hello
This rectangle appears around the text in the middle of the button. So, take the value of the string when it changes, put it in a private field. Now, make the Text = "", and draw the text yourself from te string your've stored in the paint event.
Regards
|
|
|
|
|
i'm fear to disturb you,
my button already has no text in spite of that "This rectangle appears around the text space in the middle of the button." as u said
thanks for reply
|
|
|
|
|
Hello
No text!!
You are not making this any easy, are you?
Alright! I'm out! I don't know!! What is this rectangle?? If there is no text in the button it shouldn't appear!! Something is wrong in this matter.
I want to help, but, the last thing I got in my sleeves is a bit inconvenient. Don't give your button a focus. IIRC it would be
SetStyle(ControlStyles.Selectable, false);
This way it won't get input focus, and you still can click it by the mouse -but not the keyboard-
I hope this works, otherwise I'm moving to java!;P
Regards
|
|
|
|
|
Dear Friends,
I have one DatGRid Control in my .aspx page with C#. I have last field as Status field which is boolean and is bound as checkbox control. Could you please show how can I se wether the user has checked it or uncheked it according to that I want to change the status of all customers record. if the checkbox is checked means the status is trus and i want update his status in the database through gridcontrol. I want to check all the record at one time. Even if possible I would like to give "Select all records" and "Deselect all Records" option also. Your quick response will be highly appreciated.
Thanks and Best Regards
Murtuza Patel;
|
|
|
|
|
Hello
1- To check if the value of any of the CheckBoxes has changes or not, you should handle the DatagridView.CellContentClick. Then Check the ColumnIndex and RowIndex f the e parameter to know which cell was clicked.
2- Now to check or change the value of a CheckBox, you will just have to access it right by casting it as this for example:
((DataGridViewCheckBoxCell)MyDataGridView.Rows[Y].Cells[X]).Value = true;
Where Y is the row index, and X of course is the CoumnIndex. The above line will set the value of the cell to true. You can put it in a foreach loop to set All the records to true/false.
Regards
|
|
|
|
|
How can i programatically send a shutdown or a restart command from a On_click event?
Is this possible in c#?
Thanks
|
|
|
|
|
|
how do we move a file containing an image eg pic.jpg to a certain path like "e:\vs2005\images in c#????and the file info and directory info methods cant do this.is ther any other way too move a file to a path?
any help/suggestions/ideas would be highly appreciated!
bia ali
|
|
|
|