|
|
IOCP is non-blocking I/O. What do you mean overlapped read and write? Under IOCP I/O model, one or more threads processes I/O requires and update the main process.
Kuphryn
|
|
|
|
|
There has to be a pending read on the socket for IOCP to get notified. So I have an asynchronous read pending on the sockets that are added to the IOCP. Now, I do this with blocking mode sockets, and when a thread wakes up because of an activity on the socket, I used to do recv to get some more data. I don't want the recv call to block, but just return, if there is no more data. So, I want to convert the socket to non-blocking. Since I have never used it, I was wondering whether anyone had any experience with it.
Thomas
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
WSARecv() will work well.
Kuphryn
|
|
|
|
|
How is the file associations working under Xp ? Is it still in HKEY_CLASSES_ROOT ? Because I can delete/change some entries in there without having any change in the explorer (icon, name, associated program) ...
~RaGE();
|
|
|
|
|
Hi!
Today, I switched from NT to XP at work. We use VC6.0++, and I have discovered, horrified, that I'm now unable to run it in debug mode without having VC++ to crash... It is possible to start the debugger, then to hit a few times F5, and then VC++ hangs, until debugger mode is stopped (which can take a long time since everything is sooooooo slow, just as if CPU was used at 300% ) or the app is closed using Task Manager.
Has someone already experienced something like that ? What could it be ?
Some details : Our project is actually a .dll, whose code is plain c (only the app is "windows"), and it is single-threaded, we had NT4.0 and now WinXP SP1, and VC6.0 without any SP.
Thanks for your advices ...
~RaGE();
|
|
|
|
|
Are other applications crashing? I have been using VC++ 6.0 on XP for some time with no problems. Are you using any addins?
John
|
|
|
|
|
John M. Drescher wrote:
Are other applications crashing?
Nope, nothing has been observed yet.
John M. Drescher wrote:
Are you using any addins?
No, nothing, a naked VC6.0++
~RaGE();
|
|
|
|
|
Did you reinstall VC6 after upgrading to XP?
You can try to apply patch as well
|
|
|
|
|
AlexO wrote:
Did you reinstall VC6 after upgrading to XP?
Yes.
AlexO wrote:
You can try to apply patch as well
What do you mean ?
~RaGE();
|
|
|
|
|
I meant SP (preferably latest, I think it is SP6, but I am not sure). We had some problems with "raw" VC6 as early as NT 4.
|
|
|
|
|
I always apply all the latest service packs before I use my system so I have not tried an unpatched version on XP...
John
|
|
|
|
|
Rage wrote:
VC6.0 without any SP
Stop whatever you're doing and install SP 5. I've seen VC be flaky with its compiles on 2K and XP (the dreaded internal compiler error on perfectly normal code) in the pre-SP5 builds.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Michael Dunn wrote:
Stop whatever you're doing and install SP 5. I've seen VC be flaky with its compiles on 2K and XP (the dreaded internal compiler error on perfectly normal code) in the pre-SP5 builds.
I couldn't agree more. I had the exact same problem with VS6 before I installed SP5.
// Afterall, I realized that even my comment lines have bugs
|
|
|
|
|
Hi all,
I would like to have a listctrl with multiline support. ie, each report (entry) can have mulitple lines.
how can i do that? any links ?
thanks in advance
hari
Hari Krishnan
|
|
|
|
|
|
I want to load the Accelerator that I have stored in a DLL in the EXE that link it. So I can, for example, press the Accelerator "F1" stored in the DLL and answer to the relative message in the EXE. Is it possible ?
Thank you for any answer.
Andrea
|
|
|
|
|
You can do *anything*. Some ideas on your particular problem include:
In your app init instance, load the dll(s) and extract the custom accelerator tables into a variable (or list, as appropriate).
Override the CWinApp::PreTranslateMessage(). In that handler, call TranslateAccelerator, passing the handle to your custom accelerator table. If you have more than one custom accelerator table, iterate through your list, calling TranslateAccelerator() until either your list members are exhausted or TranslateAccelerator returns non-zero. If TranslateAccelerator() returns non-zero, break and return TRUE from the PreTranslateMessage(). If your list is exhausted before PreTranslateMessage() returns a non-zero value, call the base (CWinApp::PreTranslateMessage()).
Example:
member: CPtrList m_oCustomAcceleratorList;<br />
<br />
BOOL CMyApp::InitInstance()<br />
{<br />
LoadDLLAcceleratorTables(&m_oCustomAcceleratorList);<br />
}<br />
<br />
BOOL CMyApp::PreTranslateMessage(MSG *pMsg)<br />
{<br />
HACCEL hAccel;<br />
POSITION pPos = m_oCustomAcceleratorList.GetHeadPosition();<br />
while (pPos)<br />
{<br />
hAccel = (HACCEL)m_oCustomAcceleratorList.GetNext(pPos);<br />
if (hAccel)<br />
{<br />
if (::TranslateAccelerator(m_pMainWnd->GetSafeHwnd(),hAccel,pMsg))<br />
return TRUE;<br />
}<br />
<br />
return CWinApp::PreTranslateMessage(pMsg);<br />
}
onwards and upwards...
|
|
|
|
|
Thank you very much basementman, I tried and it works. It's perfect for my problem.
Thanks a lot
Andrea
|
|
|
|
|
You can replace CFrameWnd::m_hAccelTable (AfxGetMainWnd ()) with whatever
accelerator you want.
So you can load the accelerator from a dll, then assign it as above.
Iain.
ps. Look up LoadAccelerator, AfxFindResource.
|
|
|
|
|
Hi,
I have a dialog based MFC application which has 2 timers with same interval (say 5 mins) accessing a single resource. A structure instance which is a member variable of the App class is being updated in one timer and the same structure instance is being used in another timer. ( Typically, the memory resource is being accessed for write in one timer callback and for read in another timer callback ). The code snippet something is like this,
CMyFrameDlg::TimerCallback1(...)
{
...
theApp.m_Struct.nVar1 = 10;
theApp.m_Struct.szVar2 = "test";
...
...
}
CMyFrameDlg::TimerCallback2(...)
{
...
...
localnVar = theApp.m_Struct.nVar1;
localszVar = theApp.m_Struct.szVar2;
...
}
The 2 timers get called simultaneously. Issue is, that the values dont get reflected properly in timer2 and while the struct is being accessed in timer2 it is being updated simulataneously in timer1. Both timers belong to the same Thread.
1.) I need to update the same resource in one timer and use it for some other purpose in the second timer. Is it possible ?
2.) I also have certain WM_.. messages posted from another thread to this thread on which a callback gets invoked. And this callback also accesses the same structure instance, but the values are not properly updated. Why is it so ?
Point is.. accessing the same resource ( memory) in multiple timers of the same thread. And also accessing same resource in multiple callbacks of the same thread (like user defined WM_message callbacks). Is there any restriction or way to do that ?
Anxiously Waiting for a reply
Cheers
Raja
|
|
|
|
|
Raja,
Why dont you consider using the Critical Section to avoid simultaneous access to the same resource... So, when the timers get called simultaneously, only one timer accesses the resource and the other waits till the critical section is released. If the application spans processes, you should be considering Mutex... Hope it helps you...
Harsha
----------------------------------
http://www.ece.arizona.edu/~hpg
----------------------------------
|
|
|
|
|
hi Harsha
Critical section can be used only when resource is getting accessed between 2 threads. What raja needs a way to share resource within same thread.
|
|
|
|
|
Thanks for your reply. I would like to know if critical sections can be
used to lock a section of code within the same thread. Critical Sections within same thread - possible ?
Cheers
Raja
|
|
|
|
|
I am sorry that I misunderstood the question... Anyway, I think critical sections can be used within the same thread. Although developed for multithreading, I suppose that critical sections do not understand which thread they should give access; they just know which resource to lock.
Harsha
----------------------------------
http://www.ece.arizona.edu/~hpg
----------------------------------
|
|
|
|