Jump to content

David Heffernan

Members
  • Content Count

    3536
  • Joined

  • Last visited

  • Days Won

    175

Posts posted by David Heffernan


  1. 30 minutes ago, Lars Fosdal said:

    My apologies for being unclear: One crit sec per object instance, with separate locking per object field. Return to previous description. 

    Deadlocks are perfectly possible in this scenario. 

     

    The fact that you talk about the likelihood of deadlocks is frightening. I really don't get such a defeatist approach. 


  2. 2 hours ago, Lars Fosdal said:

    Naturally, it is a simplification and doesn't apply to every context, but we used to have lots of micro locking, and lots of lock failures.  

    That's because your design was broken, not that per field locks are inherently a problem. What matters is the algorithm, and having a deep understanding of the issues. Superficial rules like the one you gave do harm in my view. 

     

    2 hours ago, Lars Fosdal said:

    Straight assignments are atomic, unless they involve logic or reallocation.

    Data needs to be aligned. That's really the key point. 

    • Like 1

  3. 55 minutes ago, Lars Fosdal said:

    Never do locking on a per field basis - unless you have one critical section per field.

    Otherwise, always lock the entire object

    Not sure I agree with this sweeping statement. Can you provide a rationale for that statement?

     

    I don't think that thread safety can be boiled down to rules like this. 


  4. That code is completely different from the original post, which did not compile. The new code doesn't compile either. 

     

    The code can't do anything useful because you will generate strings that are invalid with respect to their encoding. 

     

    What are you actually trying to do here? It's hard to get enthused for an algorithm that is so clearly flawed. 


  5. What is this code meant to be doing?  As presented here it won't compile:

     

    C := Byte(S xor T);

     

    You can't use xor with pointers.

     

    If you are hoping to perform bytewise xor on a UTF8 buffer and then interpret that as a string, that won't work. You can't guarantee that the output will be valid in any text encoding.

     

    You talk about operations on Char, but you aren't using Char. Char is a UTF-16 character element.  You are (I think) attempting to operate on bytes.

     

    It's pointless to call SetLength to allocate a string S and then write S := because the first string you allocated is just thrown away.  Each of your calls to SetLength is pointless and can be removed without changing the meaning of the program.

     

    Your for loop doesn't increment the pointers, and doesn't refer to the loop variable.  That can't be right.

     

    You have a smiley face emoji in your code. Is that meant to be a variable named D?  I guess you need to make sure that the code that you paste is correct.

     

    I recommend that you produce a complete program that you verify compiles, that produces the output you describe, and that you reproduce faithfully here.  


  6. It allows the system loader to take decisions at the time it starts up the process and before any code of the process executes. 

     

    For instance, it allows the loader to make decisions about how to resolve dependencies (assemblies). Those decisions need to be made by the loader because implicit load time dependencies are resolved by the loader. 

     

    There are many other things that are influenced by settings in the manifest. You can find out what they are by reading the documentation. 


  7. 51 minutes ago, Mark- said:

    Hello,

     

    Thanks for the response.

     

    I added in the first post, the error is on the first line.

     

    Every example I could find on the web, in many formats.

    I could not find a single working example.

     

    Mark

    I can't see your rc file. Can you include it. 

×