Untitled

posted in DruinkJournal
Published July 03, 2006
Advertisement
Hmm, I just spent the past 2 hours buggering around on Amazon.co.uk, ordering random CDs. Someone pointed me at some preview MP3s for "Razed In Black", so I thought "Ooh, I like. I'll get 3 CDs" :/ This was about the same time I realised Assemblage 23 have 4 other albums I haven't heard. Click. That makes 7. Oh yeah, VNV Nation have some other albums too. Click. That makes 11. Oh dear.

In other news, I think my socket code is working. Actually, I'll rephrase that. My socket code is completely working now, and I'll fix bigs as they appear.
I found an interesting bug today, which I feel is worth sharing.
I have code a bit like this (Psuedocode, obviously):
void CSocket::Release(){   EnterSocketMutex();   NotifyThisSocketsThreadToRemoveIt();   SetSocketsOwnerThreadToNull();   LeaveSocketMutex();}void CSocketThread::ProcessEvents(){   if(theEvent.eEvent == EVENT_RemoveSocket)   {      RemoveSocketFromThisThreadsDataStructs();      CSocketManager::Get().KillSocket(blah);   }}void CSocketThread::KillSocket(){   FreeSocket(socket.sock);   FreeBuffers(socket);   FreeMutex(socket.mutex);   FreeSocket(socket);}

Looks all ok, yes? No. I had this annoying problem where I'd get random issues elsewhere in my code. The problem stems from me recycling mutexes (mutices?). When I call FreeMutex(), the mutex gets thrown into a pool of free mutexes, and those are used when I need to allocate one in future (when a new socket connects). What I found was happening was this:
  • Thread 1: Enter socket mutex
  • Thread 1: Notify thread to remove this socket
  • OMG CONTEXT SWITCH!
  • Thread 2: "Ooh, I have an event. What is it?"
  • Thread 2: Process remove socket event, calls CSocketManager::KillSocket
  • Thread 2: Calls FreeMutex()
  • OMG CONTEXT SWITCH!
  • Thread x: "New connection! Give me a mutex!"
  • Thread x: Gets mutex, sets up socket nicely, goes back to what it was doing
    So now, Thread x has the mutex, while Thread is still in it. I can't remember what the hell happened (I thought Thread 1 tried to enter it, but that can't be right - thread 1 would need to leave the mutex before it was able to enter it...), but it was a mess anyway.



    So. Socket code is done. Server code is... Well, good enough. Tomorrow, I'll be doing stuff to the client. Such as fixing the rubbish scene manager so you don't have to keep adding everything you want to render each frame, causing the entire scene graph to be sorted each frame (Wtf was I thinking...). Basically, I want to do client stuff, because it's graphic-y and pretty.

    I've done a bit of work on my Game Design Document, I'll put it up on GDNet when it's in a reasonable state, because unlike some pople (*cough* help wanted forum *cough*) I don't expect people to steal my idea, nor do I really care if they do, since they're likely to get even less far than me.
    I decided to install the beta of Office 2007 for doing that, because Open Office was annoying me. And "Eww". It's... Horrible. Screenshot time:
    OMGWTFLOL
    First, where the shit are my menus? Point to me where "File" is, for instance. Second: it took me 10 minutes to find out why, when I tried to open a document, I only got one page, and it appeared to be as an image (I could select the page and move it around in the document, but not edit it). It turns out that dragging a file into office with no documents open actually creates a document and inserts the dropped file as an attachment. It used to open the document. Even worse, it doesn't tell you it did that, and it doesn't even use a little explorer-like icon for showint it as an attachment - it uses the first page of the document.
    Next up - I like to be able to close documents without resorting to clicking through a bunch of menus. Where's the mini 'X' button for "close document" gone?
    After that, the UI is very linux-like. You move the mouse up to the toolbars at the top (Because apparently normal menus aren't good enough), and scroll the mouse scrollwheel, and it cycles through the tabs in the toolbar. I don't know about you, but I like to throw my mouse out of the way before I start typing. Try that with Office 2007 (Beta), and you end up trying to scroll the document down via the toolbars...
    The last two things are fairly minor, but it really doesn't fit in with the rest of my windows theme. The colours are close, but it still looks really out of place. I suppose it's designed for Vista though, so that's excusable. Also, I like my nice square (or nearly square) windows. That curved corner really annoys me for some completely unknown reason, since unlike MSN (Well, the non-Live version), you don't seem to get a choice about framing it in a normal square window.

    And don't get me started on MSN Live - I installed it on my server, because I wanted to quickly say something to a friend and couldn't be bothered starting up my PC (Then realised I didn't have MSN installed on my server...). It's fucking ugly. Give me nice square windows and non-bluey-metallic colour schemes and I'll be happy. Yes, I know, I have no taste.

    Right. I have to be up in 7 hours, and I'll be doing overtime for most of the next 2 weeks I expect, so bed.
  • Previous Entry Unt1t13d
    Next Entry Untitled
    0 likes 5 comments

    Comments

    TraderJack
    Where do you get the cash for all of these CDs?

    -IV
    July 03, 2006 05:48 PM
    Evil Steve
    Quote:Original post by TraderJack
    Where do you get the cash for all of these CDs?

    -IV
    I got paid on Friday, and I need to spend it before it evaporates. That tends to happen to a lot of my cash...
    Also, those 11 CDs came to just under £100, which isn't too bad.
    July 03, 2006 06:14 PM
    ukdm
    Check out www.cdwow.com next time you are buying... usually cheaper than Amazon and you get a money off voucher everytime you purchase. Their albums are never more than £8.75 (unless it's a double) and the money off voucher is 50p.

    ukdm
    July 04, 2006 01:46 AM
    sirob
    Meh, I've been liking Word 2007 so far.

    Go into Insert -> Cover Page and put in a decent one. That's just... oh the horror.
    July 04, 2006 04:15 AM
    Programmer16
    Agh, that looks horrid. I dislike the rounded corners because you can click what's behind them (in XP anyway.)
    July 04, 2006 11:37 AM
    You must log in to join the conversation.
    Don't have a GameDev.net account? Sign up!
    Advertisement
    Advertisement