User Profile

Collapse

Profile Sidebar

Collapse
iLL
iLL
Last Activity: Nov 17 '10, 01:54 AM
Joined: Oct 22 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • iLL
    started a topic Thread Safty w/ WeakReferences
    in Java

    Thread Safty w/ WeakReferences

    Okay... I've got a question about weak references

    Is it possible for the clear() method to be called by the garbage collector when there is still a strong reference in the system?

    I'm specifically concerned about the following scenario:

    1. The GC finds no strong reference and decides to clear the weak reference object
    2. A context switch occurs and GC stops executing
    3. The get() method is called...
    See more | Go to post

  • iLL
    replied to Sockets and Synchronization
    in Java
    I think I'll give that a shot.

    I got it working by blocking threads... But it caused communication to be about 20% slower.

    Thanks for the reply.
    See more | Go to post

    Leave a comment:


  • iLL
    started a topic Sockets and Synchronization
    in Java

    Sockets and Synchronization

    Okay, so I'm tying to get use to programming with sockets, and I have run into a bit of a snag.


    As of now, my program basically works like this:

    Server: Listen for a connection
    Client: Request a connection
    Server: Accept connection
    Client: Send message
    Client: Wait for response
    Server: Processes message
    Server: Send response

    I want my client to also listen...
    See more | Go to post

  • iLL
    replied to midi synth works with jdk but not jre
    in Java
    Thanks for your help
    See more | Go to post

    Leave a comment:


  • iLL
    replied to midi synth works with jdk but not jre
    in Java
    No I don't have it in there.

    Should it be there on install? Can I assume that other people will have it?

    If not, is it legal to upload it to a server and use that as my soundbank, or is that copyright infringement?
    See more | Go to post

    Leave a comment:


  • iLL
    replied to midi synth works with jdk but not jre
    in Java
    I'm trying to use the default soundbank. Is that only available through the JDK?

    Edit: Ignore that. Let me check.
    See more | Go to post

    Leave a comment:


  • iLL
    started a topic midi synth works with jdk but not jre
    in Java

    midi synth works with jdk but not jre

    Can someone tell me why this code works with "Java\jdk1.6.0_ 07\bin\java.exe " but does not work with "Java\jre1.6.0_ 07\bin\java.exe "

    Code:
    import javax.sound.midi.*;
    
    
    public class sound
    {
    	public static void main(String[] args)
    	{
    		try
    		{
    			Synthesizer synthesizer = MidiSystem.getSynthesizer();
    			synthesizer.open();
    
    			synthesizer.getChannels()[0].noteOn(60,
    ...
    See more | Go to post

  • Thanks ;)

    ............... ..
    See more | Go to post

    Leave a comment:


  • I'm still a little confused

    If I implement mutual exclusion properly, then do I still need to worry about implementing it this way?

    And if I do use this method, do I still need to use locks? And if not, what if two different threads call Invoke at the same time, how does that work? Does some sort of stack keep track of waiting Invoke calls?
    See more | Go to post

    Leave a comment:


  • Sorry for this but... Bump
    See more | Go to post

    Leave a comment:


  • iLL
    started a topic Confused about using Invoke in worker threads. - C#
    in .NET

    Confused about using Invoke in worker threads. - C#

    So why is it that we need to use the Invoke method when updating the GUI?

    The following is the way we are suppose to update GUI components:

    Code:
    delegate void textIt(object o);
    public partial class Form1 : Form
    {
            public Form1()
            {
                InitializeComponent();
            }
            private void Form1_Load(object sender, EventArgs e)
            {
    ...
    See more | Go to post

  • iLL
    replied to GUI Thread in C#
    in .NET
    If every thread has access to your FormX class, I don't see why you can't make a method that updates a label. Only one thread can do this at a time.

    You can also make a label public. This might be bad though.



    You don't need any lock if you are only reading. As for two hot links activating an event at the same time, is that possible?...
    See more | Go to post

    Leave a comment:


  • iLL
    replied to GUI Thread in C#
    in .NET
    I hate to tell you this, but I have no experience with dealing dynamic data exchange.

    But let me see of I have this correct.

    You have some data coming through the buffer. When the data comes in, it triggers an event. When this event is triggered, some thread will update the label. Is that correct?

    And you are using 14 threads so that you can read the data fast enough?...
    See more | Go to post

    Leave a comment:


  • iLL
    replied to GUI Thread in C#
    in .NET
    After taking a little closer look at your code. I don't see how it is hanging. Here we should only worry about race conditions, and there should not be anything hanging on a race condition. Deadlocks and starvations causes hangups. Does it hang up at the same spot every time? Does it work for one or two threads? Or does it not work at all?
    See more | Go to post

    Leave a comment:


  • iLL
    replied to GUI Thread in C#
    in .NET
    I didn't really look to close at your code, but I think you need a global Mutex lock

    Example:

    Code:
    class blah
    {
    	System.Threading.Mutex mLock;
    	
    	public blah()
    	{
    		mLock = new System.Threading.Mutex
    	}
    	
    	public void method1()
    	{
    		mLock.WaitOne();
    		// Critical Section
    		mLock.Release();
    	}
    ...
    See more | Go to post

    Leave a comment:


  • iLL
    replied to C# and pointers
    in .NET
    Thanks a lot.

    I've learned more in these few posts then I have in the few chapters I've read from my C# book
    See more | Go to post

    Leave a comment:


  • iLL
    replied to C# and pointers
    in .NET
    Now C# implements destructors, right?

    If you set the object variable to null then call GC.Collect() in the destructor, that should take care of things.



    So is that by design, or is it just a bug?...
    See more | Go to post

    Leave a comment:


  • iLL
    replied to C# and pointers
    in .NET
    You think so?

    I like C++, I just don't like VC++. Microsoft just over complicated it, I find that I spend more time fighting it then getting work done.

    Though I like managing my own garbage as any C/C++ programmer, I think it would be a bad idea to start complicating C#.


    And I don't usually use .NET being a student, however I think I should learn it myself. I see that most jobs require it.
    See more | Go to post

    Leave a comment:


  • iLL
    replied to C# and pointers
    in .NET
    I don't know if you care, but this is what I gathered since posting this yesterday.

    Pointers are unsafe because garbage collection moves data around. It is possible for GC to move data that is currently being pointed to, making a pointer point to unallocated data. To fix this C# has a concept of a fixed pointer. It looks a little like this:

    Code:
    fixed (int* p1 = &x)
    {
        fixed (double* p2 = &y)
    ...
    See more | Go to post

    Leave a comment:


  • iLL
    started a topic C# and pointers
    in .NET

    C# and pointers

    Okay, I'm teaching myself C# and now I have a question about pointers.

    When if I declare a new object, do I need to delete it? Or does garbage collection take care of that too. It seems a little odd to declare a peace of code “unsafe” if it's perfectly safe.

    If it is possible to manually deallocate, how do I do it?
    See more | Go to post
No activity results to display
Show More
Working...