Creating a deadlock example C# Exam 70-483: error?

I have the book
Exam Ref 70-483 Programming in C#.
Listing 1-37(Page 33) shows an example of a deadlock.
public class Program
static void Main(string[] args)
object lockA = new object();
object lockB = new object();
var up = Task.Run(() =>
lock (lockA)
Thread.Sleep(1000);
lock (lockB)
Console.WriteLine("Locked A and B");
lock (lockB)
lock (lockA)
Console.WriteLine("Locked B and A");
up.Wait();
In the paragraph, it says: Because both locks are taken in reverse order, a deadlock occurs. The first
Task locks A and waits for B to become free. The main thread, however, has B locked and is waiting for A to be released.
However I tried the code, there was no deadlock at all.
Anything wrong?

You didn't get any deadlock because the main thread completed before the secondary thread had the time to take its first lock. If you want to see the deadlock, add a Thread.Sleep(1000) in the main thread after taking the lock on lockB (in the same way
that the secondary thread does a Sleep after taking lockA).

Similar Messages

  • Share library created for HellowWorld example can't be loaded

    I created the HelloWorld example on solaris. However, it always fails with exception UnsatisfiedLinkageError "no hello in java.library.path". I printed out the java.library.path property, my library is in the path. My code works if I copied one of java's own shared library to libhello.so, and the library can be loaded. I used Sun workshop compiler and used -G option to create shared library. Any help would be greatly appreciated. Thanks.
    Bao

    Please run your program like this,
    java -Djava.library.path="<Path to your DLL>" <Your main class>
    This should work.
    Check whether the method that you are calling from the native interface is available in the DLL.
    Please post some more error.
    LathaDhamo.

  • List of steps required to create simple planning example

    Hello
    I am new to BPS
    Could you please give me a list of steps required to create simple planning example.
    Thanks
    Message was edited by: Aleksandrs Frolovs

    Hi Aleksandrs,
    Here is some good info:
    http://help.sap.com/saphelp_nw04/helpdata/en/5d/7c4b52691011d4b2f00050dadfb23f/content.htm

  • I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 profession​al. The create new report VI opens Excel but throws error (-21471672​62- from automation open VI) when I try to open MS word. please help...

    I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 professional. The create new report VI opens Excel but throws error (-2147167262- from automation open VI) when I try to open MS word. please help...

    Hi Leo22,
    Does this error occur if you use any of the example programs that come shipped with LabVIEW? I would try opening one of the examples that write data to Word and see if those give you an error. Also, have you tried just putting down a New Report.VI and change the report type to Word? If this simple vi (that's all you need to open Word) breaks, I would check to see if there are any instances of Word still open. Check the task manager to see if any word processes are still open. There should not be a problem accessing Word 2003 from LabVIEW 7.0. If neither of these solutions work, please give some more detail about your application and we can research further. Thanks!
    Jeremy L.
    National Instruments
    Jeremy L.
    National Instruments

  • This is an example of schema validating with error feedback

    Hi,
    Hope this is of help....
    This is an example of schema validating WITH error feedback
    public boolean validate(InputStream is) {
    // create and setup the DOM parser object
    parser = new DOMParser();
    parser.setPreserveWhitespace(false);
    parser.setValidationMode(XMLConstants.SCHEMA_STRICT_VALIDATION);
    boolean isValid = false;
    if (is != null) {
    try {
    parser.parse(new InputSource(is));
    isValid = true;
    } catch (XMLParseException e) {
    for (int i = 0; i<e.getNumMessages() ;i++){
    System.out.println("XMLParseException nr:"+new Integer(i+1)+" \'imsmanifest.xml\' line nr: "+new Integer(e.getLineNumber(i))+" col nr:"+
    new Integer(e.getColumnNumber(i))+" (formatErrorMessage: "+e.formatErrorMessage(i)+") ["+e.getMessage(i)+"]");
    } catch (java.io.IOException e) {
    System.out.println("IOException: Error creating input source [" + e.getMessage() + "]");
    } catch (org.xml.sax.SAXException e) {
    System.out.println("SAXException: Error parsing [" + e.getMessage() + "]");
    } catch (Exception e){
    System.out.println("Exception: Error parsing [" + e.getMessage() + "]. ");
    doc = parser.getDocument();
    return isValid;
    regards
    Jon

    "personally, I'd just put the exception handling into the package."
    Maybe I am making this over-complicated. I would like all the error handling in the package. It seems like putting an ONSERVERERROR trigger would be a little overkill, and if it fires on every database error, and I have to screen for only my errors seems like a little overkill and to me, it seems like it would incur quite a bit of overhead for the database seeing it is firing for every error. I don't even know if I would ultimately be allowed to keep it.
    Really, all I would want to do is:
    1) Handle the error and recover if possible
    2) If it is a fatal error, have a way to abort the package gracefully with some kind of record of it.
    3) Allow for the possibility of non-fatal errors or messages, even that I might generate myself to be able to be logged.
    This package has about 20 procedures now. If I have an error (particularly fatal), in let's say, procedure 8, I don't even know what happens. I don't know if by default it aborts the whole package or just that procedure or just keeps going. Is it possible to get just hung up and sit there?
    Thanks for the input.

  • I am using Adobe Acrobat 9 Standard version in Windows 8.1 and when I try to create a .pdf file, I receive the following error message "Acrobat could not open "file name.log" because it is either not a supported file type or because the file has been dama

    I am using Adobe Acrobat 9 Standard version in Windows 8.1 and when I try to create a .pdf file, I receive the following error message "Acrobat could not open "file name.log" because it is either not a supported file type or because the file has been damaged.  To create a PDF document, go to the source application then print the document to .pdf"  I am going to the source application and printing the document to .pdf yet it's saving the file as a .log file.  After reinstalling the software, I initially didn't encounter this problem but on my second and third attempts to convert files to .pdf format, this error message reappeared.  How do I resolve this problem?

    I have a similar problem which i did not have before...and it exists only in some powerpoint files which i want to print as a pdf file...and i get the same message as above.
    the log says the bellow details...what's the problem and how can i resolve it? thanks.
    %%[ ProductName: Distiller ]%%
    %%[Page: 1]%%
    %%[Page: 2]%%
    Cambria not found, using Courier.
    %%[ Error: invalidfont; OffendingCommand: show ]%%
    Stack:
      %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%

  • A fatal error occurred while creating an SSL client credential. The internal error state is 10011.

    Need help.  I have my pilot lync 2013 pool up (in coexistence with 2010 production environment) and can log into Lync 2013 environment with a lync 2010 client but am not able to with a lync 2013 client.  It just prompts for password but will not
    take it. I'm sseeing this on my front end server multiple times:
    A fatal error occurred while creating an SSL client credential. The internal error state is 10011.
    Came across this http://www.logicspot.net/index.php?id=50 and tried disabling TLS 1.2, which I did and verified but yet the issue still exists.
    All my certs are good coming from internal CA.  My signin logs show below but keep in mind, this works just fine if using a 2010 lync client to my lync 2013 servers.  Issue only occurs when trying to connect using a lync 2013 client.
    1 Login: FAIL (hr = 0x1) 
    this request needs authentication, trying webticket from: https://domain.com/WebTicket/WebTicketService.svc
    1.1 Get-NewWebTicket: FAIL (hr = 0x1) 
    CLogonCredentialManager::QueryForSpecificCreds() Credential user 0x069B64A0 id=15 querying for specific credentials, credSuccess=2, targetName=Microsoft_OC1:[email protected]:specific:LAD:1
    1.1.1 ExecuteWithMetadataInternal: FAIL (hr = 0x3d0000) 
    Executing wws method with windows auth auth, asyncContext=0A4FC348,
     context: WebRequest context@ :173931816
      MethodType:4
      ExecutionComplete? :1
      Callback@ :0A5A1864
      AsyncHResult:80f10041
      TargetUri:https://domain.com/WebTicket/WebTicketService.svc
      OperationName:http://tempuri.org/:IWebTicketService
     Error:
    There was an error communicating with the endpoint at 'https://domain.com/WebTicket/WebTicketService.svc'.
    The server returned HTTP status code '401 (0x191)' with text 'Unauthorized'.
    The requested resource requires user authentication.
    1.1.2 ExecuteWithWindowsOrNoAuthInternal: PASS
    1.1.3 ExecuteWithWindowsOrNoAuthInternal: FAIL (hr = 0x3d0000) 
    Executing wws method with windows auth auth, asyncContext=0A4FC348,
     context: WebRequest context@ :173931816
      MethodType:4
      ExecutionComplete? :1
      Callback@ :0A5A1864
      AsyncHResult:80f10041
      TargetUri:https://domain.com/WebTicket/WebTicketService.svc
      OperationName:http://tempuri.org/:IWebTicketService
     Error:
    There was an error communicating with the endpoint at 'https://domain.com/WebTicket/WebTicketService.svc'.
    The server returned HTTP status code '401 (0x191)' with text 'Unauthorized'.
    The requested resource requires user authentication.
    1.1.4 ExecuteWithWindowsOrNoAuthInternal: FAIL (hr = 0x3d0000) 
    Discovery task(0A4FF830) sent to URL http://domain.com completed with hr=0x80f10045
    1.1.5 ExecuteWithWindowsOrNoAuthInternal: FAIL (hr = 0x3d0000) 
    Executing wws method with windows auth auth, asyncContext=0A4FC348,
     context: WebRequest context@ :173931816
      MethodType:4
      ExecutionComplete? :1
      Callback@ :0A5A1864
      AsyncHResult:80f10041
      TargetUri:https://domain.com/WebTicket/WebTicketService.svc
      OperationName:http://tempuri.org/:IWebTicketService
     Error:
    There was an error communicating with the endpoint at 'https://domain.com/WebTicket/WebTicketService.svc'.
    The server returned HTTP status code '401 (0x191)' with text 'Unauthorized'.
    The requested resource requires user authentication.
    1.1.6 ExecuteWithWindowsOrNoAuthInternal: FAIL (hr = 0x3d0000) 
    CLogonCredentialManager::QueryForSpecificCreds() Credential user 0x069B64A0 id=15 querying for specific credentials, credSuccess=2, targetName=Microsoft_OC1:[email protected]:specific:LAD:1
    Rich

    Hi,
    Please check the server role and Web Services for Internet Information Services (IIS) are set correctly.
    For the detailed IIS configuration, please check:
    http://technet.microsoft.com/en-us/library/gg412871.aspx
    As Lync client 2013 attempt to query in order to perform autodiscover of the Lync registration server. First
    lyncdiscoverinternal.<sipdomain> Host (A) record and then
    lyncdiscover.<sipdomain> Host (A) record. If neither of these records are resolvable then the legacy DNS SRV and A record fall-back process is used. So make sure you have add the two A record in DNS server.
    More details:
    http://blog.schertz.name/2012/12/lync-2013-client-autodiscover/
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
    sure that you completely understand the risk before retrieving any suggestions from the above link.
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • While creating a device category i'm getting an error "enter a valid division via eg01,how can the error be overcom?

    While creating a device category i'm getting an error "enter a valid division via eg01,how can the error be overcome?

    Neha,
    you can do in two ways.
    1. Enter a valid Division which you configured in the system.
    2. Remove the Division as required field. However I suggest it should have a valid division. Why can not you check with your Functional owner?
    Linganna Katigiri

  • While creating customer master  i am getting the Communication error

    Hi experts,
    while creating customer master  i am getting the  Communication error with the external tax system (VERTEX_MS0018)    please tellme how to solve this issue
    Regards,
    Anil prasad
    Edited by: prasadanil on Sep 16, 2011 12:52 PM

    hI Prasad,
    It seems you are maintaining the address data for a country with jurisdiction code. Different external control systems can behave in different ways.
    1. You entered a jurisdiction code that matches the postal code but not the city (possibly due to a typo).
    a) Behavior when you use Taxware: There is no message and data can be saved.
    b) Behavior when you use Vertex: Due to the incorrect city, no comparison jurisdiction code can be determined and message TAX_TXJCD861 is issued with a text from the vertex system that may be unintelligible.
    2. You do not enter a jurisdiction code, but you do enter a postal code and a city that does not match the code (possibly due to a typo).
    a) For Taxware: If the jurisdiction code could not be explicitly determined, a selection dialog box containing the relevant tax jurisdiction codes for the postal code appears. You select one. This and the corresponding city are transferred.
    b) For Vertex: The TAX_TXJCD861 message is issued (behavior as in 1b). Other terms TAX_TXJCD861, TAX_TXJCD101, TAX_TXJCD107.
    For resolving this issue, you can check SAP Note 677850 - Address data: Check/new determination jurisdiction code.
    Hope you will resolve the above issue with these inputs.
    Let me know if you need any further details.
    Ravi.

  • Every time i try to create a new movie or a trailer an error message appear saying:"the operation could not be completed. no other information is available about the problem."

    every time i try to create a new movie or a trailer an error message appear saying:"the operation could not be completed. no other information is available about the problem."

    Open the iCloud preference pane and uncheck the Contacts box. Do the alerts stop?

  • A fatal error occurred while creating an SSL client credential. The internal error state is 10013.

    Hi All
    I am seeing the below event appearing in the system log on all our Exchange 2013 servers regularly. I am not seeing any connectivity issues between any clients and the servers and no other issues have been reported at this stage.
    Log Name:      System
    Source:        Schannel
    Date:          10/04/2015 9:21:17 AM
    Event ID:      36871
    Task Category: None
    Level:         Error
    Keywords:     
    User:          SYSTEM
    Computer:     
    Description:
    A fatal error occurred while creating an SSL client credential. The internal error state is 10013.
    I am not sure if its related to the public certificate we are using or if its related to the one provided from the local CA.I have searched and found other links that suggest it could be related to SSL versions being disabled etc.
    All servers are running Windows 2012 R2 Datacenter. The Exchange CAS servers do also sit behind a pair of F5 BIG IP Load Balancers 
    Any suggestions on where to look?
    Thanks

    Hi,
    According to the event log, the issue is related to Schannel instead of Exchange.
    Please try the following steps:
    1.In Control Panel, click Administrative Tools, and then double-click Local Security Policy.
    2.In Local Security Settings, expand Local Policies, and then click Security Options.
    3.Under Policy in the right pane, double-click System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing, and then click Enabled.
    4. Ran gpupdate /force
    If it doesn’t work, please go to C:\ProgramData\Microsoft\Crypto\RSA and grant "Network Services" Read permission to "MachineKeys" folder. Then restart server to have a try.
    Here is a similar thread for your reference:
    https://social.technet.microsoft.com/Forums/lync/en-US/e70a8dbc-6f48-4fde-a93b-783554344822/a-fatal-error-occurred-when-attempting-to-access-the-ssl-client-credential-private-key?forum=ocscertificates
    Regards,
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Winnie Liang
    TechNet Community Support

  • Whenever messages created in XI, initially it will go to error status

    Whenever messages created in XI, initially it will go to error status
    As soon as IDOCs released in ECC system the messages are going to error status. But they are processing successfully later. They are going to error state as soon a they release. Thats the problem.
    Information message "XML message not found". But I am able to see XML message in payload. When I try to reprocess the message it will succeed. It is happening for all the interfaces.
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Interface Determination
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="PERSIST">MESSAGE_NOT_FOUND</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>XML message not found</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Please provide any help.

    Hi !
    It seems that the message type / interface message defined in interface determination does not match with one in the message. Are you using the imported IDOC as interface message or did you create a new interface mapping? you should use the imported IDOC in interface  mapping and also in interface determination objects. Also try to reactivate the interface determination object.
    Regards,
    Matias.

  • Can someone tell me how to create accounting entries with the account status as error

    Hi,
    Can someone tell me how to create accounting entries with the
    account status as error?
    Thanks!!
    Danny

    It's call fixed/static background, and it is NOT directly support by iweb, you will need post processing either in html or javascript.
    Varkgirl (you need to search the previous forum) and I did it since iweb1:
    try Safari, and scroll: http://www.geocities.com/[email protected]/Links.html
    invisible link? roddy, fishing for info again?

  • FM 12: How do I create a .ps file of a book? (errors prevent PDF generation)

    FM 12: How do I create a .ps file of a book? (errors prevent PDF generation)

    There's probably a graphic on one of your pages that is causing a postscript division error (i.e. divide by zero?) See also: PostScript error offending command div
    As Jeff suggests, track down the errant graphic to see what's wrong. If you print to file, you should get an idea of roughly where in the docs the error occurs by watching the print thermometer display.

  • Creating a view using With causes ORA-00600 Error

    Hello Ladies and Gents,
    I've been trying to deploy a recursive query as a view in Oracle XE and Standard Edition, neither to much success.
    The query is located in this question here: http://stackoverflow.com/questions/17358109/how-to-retrieve-all-recursive-children-of-parent-row-in-oracle-sq
    with recursion_view(base, parent_id, child_id, qty) as (
       -- first step, get rows to start with
       select
      parent_id base,
      parent_id,
      child_id,
      qty
      from
      md_boms
      union all
      -- subsequent steps
      select
       -- retain base value from previous level
      previous_level.base,
       -- get information from current level
      current_level.parent_id,
      current_level.child_id,
       -- accumulate sum
       (previous_level.qty + current_level.qty) as qty
      from
      recursion_view previous_level,
      md_boms current_level
      where
      current_level.parent_id = previous_level.child_id
    select
      base, parent_id, child_id, qty
    from
      recursion_view
    order by
      base, parent_id, child_id
    The query itself works and returns results. However, when I try to create a view with that query, I receive errors.
    I've posted two screenshots: http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/ViewError.jpg and http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/InternalError.jpg The first one with the ! and * is when I am using JDeveloper 11g, using the Database Navigator, right-click on View and select "New View". I receive the error when I click OK. I can indeed create the view through a sql script, but when I attempt to view the data, I receive the ORA_00600 error.
    I've tried this on both my local machine for XE (version 11.2.0.2.0) and on 11g Standard Edition (11.2.0.2.v6) via Amazon Web Services. The result is the same.
    Does anyone know how to get around this?

    Not 5 minutes after I post this, I decide not to use JDev's graphical editor, and simply write
    SELECT * FROM BOMS_VIEW;
    And it works like a charm.  I just can't use data tab to view the records in the editor.  Wish I had known that 5 hours ago.

Maybe you are looking for

  • Convert from int to char

    Hi, How can I convert from an int to char?

  • HT6154 All of a sudden after taking a picture my phone will not swipe or unlock or power off.

    All of a sudden after taking a photo, I locked my phone and now I can not swipe or power off or get into my phone!

  • How do i change what the stop button does

    Is it possible to change the behavior of the 'STOP' button depending on the state of the 'PLAY' button? What I would like is this; When Logic is playing the 'STOP' button stops play leaving the playhead where it is. If the stop button is pressed agai

  • Still no 7.8 in India?

    Hi, My Lumia 800 is still on 7.5, the 7.8 update notification update still doesn't show up. I've tried with Zune, have the phone set to check for updates...but still nothing. The 7.5 update came fast enough. When can I expect the 7.8 to show up? The

  • Error while using Display queue

    Hi, I have a strange problem here.I have a ifwithoutelse condition,the output of which is given to removecontext.Now while seeing the output using display queue on "ifwithoutelse" im able to see the output as "GB" which is my desired ouput.Now the ou