Can i get a deadlock?

This is a discussion on Can i get a deadlock? within the Windows Programming forums, part of the Platform Specific Boards category; I am playing a little with recording from the soundcard and im wondering if i can write the samples to ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    76

    Can i get a deadlock?

    I am playing a little with recording from the soundcard and im wondering if i can write the samples to the disk (using fwrite) from withing the callback function. MSDN states te folowing:


    Applications should not call any system-defined functions from inside a callback function, except for EnterCriticalSection, LeaveCriticalSection, midiOutLongMsg, midiOutShortMsg, OutputDebugString, PostMessage, PostThreadMessage, SetEvent, timeGetSystemTime, timeGetTime, timeKillEvent, and timeSetEvent.Calling other wave functions will cause deadlock.

    (from http://msdn.microsoft.com/library/de...waveinproc.asp )


    I believe this is a little ambiguous. Should i NOT call system functions, or should i NOT call wave functions. What does "system functions" mean anyway? Are that all function from windows??
    Last edited by johny145; 09-18-2005 at 01:00 PM.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,262
    In this scenario, I'm faily certain they mean all system functions. By system functions, they are referring to windows API functions. You should still be able to make calls into the C runtime library, just make sure you use the multithreaded version of the CRT.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    I don't think the documentation is saying that any system function will cause a dead lock. To me, it's saying first that you shouldn't call any system functions from the callback and second thatthe wave functions will cause deadlock. (Maybe the callback needs to be accomplished in some amount of tmie?) I would just follow the documentation in this situatiion. I'd call PostMessage or PostThreadMessage to direct the message to my own thread or main window and handle it from there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Deadlock prevention in C
    By simpatico_qa in forum C Programming
    Replies: 12
    Last Post: 05-04-2009, 01:35 PM
  2. Replies: 10
    Last Post: 07-17-2008, 12:21 PM
  3. Deadlock - graph/edge/cycle - help with terminology
    By patricio2626 in forum C++ Programming
    Replies: 4
    Last Post: 11-24-2006, 04:22 PM
  4. Deadlock
    By Claudigirl in forum C Programming
    Replies: 2
    Last Post: 11-06-2003, 03:11 PM
  5. Guys, need help RE: deadlock avoidance
    By tribal in forum C++ Programming
    Replies: 2
    Last Post: 11-20-2001, 03:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21