IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.20 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-06-15
Pages: < Prev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Next >
[18:18]<vxyzmly2z>ok, i just want to know when something has already occured in my app if a user reruns the class. is there a way to save an string or an array in app settings and read the value later
[18:18]<azyfm>I wasn't saying you shouldn't paste code, just that you should also give some indication of the problem here
[18:18]<jjxgdjn6n1>wow .NET threads, thats way over my head :D
[18:19]<irbmn>fair enough, it's just quite a complex problem to describe so I thought it was simpler to simply paste the code and on the line the exception is occuring, point out "this is what's happening here. I don't know why", rather than trying to summarize the whole behaviour of the code here etc
[18:19]<irbmn>So anyway - any ideas?
[18:20]<azyfm>hm, there's only ever supposed to be a single request active?
[18:21]<irbmn>basically multiple threads submit requests, which are added to a queue, and a single thread takes requests off the queue and processes them one at a time
[18:23]<azyfm>do you call Start() and Stop() more than once?
[18:23]<vxyzmly2z>why do people just ignore me
[18:23]<vxyzmly2z>it's not that crazy of a question
[18:23]<vxznrm_>wouldnt matter with his double lock anyway, would it?
[18:23]<irbmn>Arild yes it can be started and stopped anyway
[18:23]<irbmn>er, any time
[18:24]<vxyzmly2z> i just want to know when something has already occured in my app if a user reruns the class. is there a way to save an string or an array in app settings and read the value later
[18:24]<vxyzmly2z>similar to sessions in php
[18:24]<azyfm>also, ever considered using the ThreadPool?
[18:24]<azyfm>thirdLibr - just create a Settings file
[18:24]<irbmn>I don't need a thread pool as I only have a single thread
[18:25]<irbmn>thread pools are for when you want to create lots of little threads that do small jobs, AFAIK
[18:25]<azyfm>thread pools are for when you want to avoid creating lots of little threads that do small jobs :-P
[18:26]<irbmn>well, exactly. It creates them all for you and hands them out as you need them.. but like I said.. I only ever have one thread so this isn't anything to do with ThreadPool's
[18:27]<azyfm>well, I don't see it :-(
[18:28]<azyfm>there's got to be some kind of race here, but I don't see it
[18:28]<vxznrm_>me neither
[18:28]<vxznrm_>however, was wondering
[18:28]<vxznrm_>in the Stop method
[18:28]<vxznrm_>you do running=false
[18:28]<vxznrm_>and queueWaiter.Set() afterwards
[18:29]<vxznrm_>but as you set running to false, the context could switch to the request processing thread
[18:29]<vxznrm_>which sets queueWaiter to null
[18:29]<gwyvmggu>hello has anyone here used iron speed before
[18:29]<vxznrm_>after which you call queueWaiter.Set() in the stop method
[18:29]<irbmn>thread_, interesting idea. Lemme add a check for it being null there then
[18:29]<azyfm>ahhh
[18:30]<vxznrm_>yea
[18:30]<vxznrm_>does it highlight queueWaiter.Close() when debugging and that exception is thrown?
[18:30]<azyfm>the main problem being is that RequestThread relies on the value of running without holding the mainSync lock
[18:30]<gwyvmggu>more specificly has anyone used ironspeed with subversion for version control specificly
[18:31]<npyvnpjzan>hey, how should i stop a thread which is blocked by socket.Accept(); ?
[18:31]<azyfm>use a timeout?
[18:31]<irbmn>Arild I have running declared as volatile, and reading a primitive int should be atomic, so I reckon that shouldn't be a problem
[18:31]<azyfm>avoid explicit threads completely and use async sockets?
[18:32]<sdnffdxdlld>use an asyncrnous accept so it doesnt block?
[18:32]<sdnffdxdlld>hehe :P
[18:32]<azyfm>reading it might be atomic, reading it and comparing it to something isn't
[18:32]<npyvnpjzan>well it doesnt block then but i still have the problem with stopping the thread
[18:32]<azyfm>that's why you have Interlocked.CompareExchange
[18:33]<irbmn>Well thread_ I added the check, HOWEVER, I'm now getting an exception on the Dequeue line because apparantly the queue is empty
[18:33]<azyfm>set a flag called running to false...
[18:33]<npyvnpjzan>how would i stop BeginAccept?
[18:33]<azyfm>@ eliteforce :-P
[18:34]<azyfm>eliteforce, read this: http://www.interact-sw.co.uk/iangblog/2004/09/23/threadless
[18:34]<azyfm>IRBMe - considered using a semaphore instead of the ARE?
[18:34]<irbmn>What would that accomplish, if you don't mind me asking?
[18:34]<vxznrm_>hmm, that sounds even more strange
[18:35]<azyfm>seems a more elegant solution, the semaphore count is raised for every request put in the queue, the processing thread waits on the semaphore
[18:35]<azyfm>if the semaphore is at 0, the processing thread sleeps until something is put in
[18:36]<irbmn>That sounds sensible. I'll give it a try then
[18:36]<npyvnpjzan>Arild: eh yeah but without a thread it would either be consuming much cpu time or be less responsive
[18:36]<azyfm>eliteforce - no, async sockets are less consuming of CPU time and more responsive
[18:36]<azyfm>read the article
[18:37]<npyvnpjzan>Arild: async sockets are normal sockets in a thread held in a thread pool
[18:37]<irbmn>ah I'm not using .Net 2.0, is there an equivelant Semaphore in .Net 1?
[18:37]<irbmn>Async sockets usually try to use the native IO Completion provided by the OS if available
[18:39]<npyvnpjzan>btw, why do i read in every example "new AsyncCallback(..)" instead of creating it once as member?
[18:40]<txnjzd>personally I'd use threads over async methods most of the time just because it's easier (for me) to follow what is going on, so I'm less likely to introduce bugs
[18:41]<rnmvx>i find the opposite
[18:42]<azyfm>no, Semaphore was introduced in 2.0
[18:42]<npyvnpjzan>IRBMe: whatever native io completion they try to use, they also add overhead
[18:42]<azyfm>remove overhead
[18:43]<azyfm>IO Completion Ports is the only meaningful way of creating a high perf socket server on Windows
[18:44]<irbmn>Indeed. Using IO Completion ports is very efficient, and it's what the Begin* methods in Socket try to use if it's available
[18:45]<svzz[wjzc]>goddamn those comboboxes are driving me crazy, i can't even set my event handler after the box is filled because of my structure... what an annoying day
[18:45]<npyvnpjzan>they also have to lookup an avaiable thread in the threadpool
[18:45]<rnmvx>this is interesting, i wrote some sockets libraries a long time ago, and only really learned about IO completion ports after taht
[18:45]<rnmvx>so you're saying that the async socket methods actually do use IOCP's if possible
[18:47]<npyvnpjzan>lets say i use BeginAccept, how would i stop that thread?
[18:47]<npyvnpjzan>without leaving it in an inconsitent state
[18:47]<azyfm>set running to false :-P
[18:48]<npyvnpjzan>running?
[18:48]<svzz[wjzc]>okay new question : Is there a way to fill a combobox items collection without losing my initial "null" value ? setting the .datasource doesn't work
[18:48]<npyvnpjzan>setting a boolean varible doesnt stop a thread
[18:48]<npyvnpjzan>which is blocked
[18:49]<azyfm>BeginAccept doesn't block, which is the point
[18:49]<npyvnpjzan>of course it doesnt, but how can i stop it?!
[18:50]<npyvnpjzan>i wanna stop the socket from accepting after i push a button
[18:50]<npyvnpjzan>and i dont wanna close the socket
[18:50]<azyfm>that'd be up to the code calling EndAccept, wouldn't it?
[18:52]<npyvnpjzan>The EndAccept method blocks until a connection is pending in the incoming connection queue.
[18:52]<irbmn>jeez..
[18:52]<irbmn>close the socket..
[18:53]<irbmn>if you call Accept, it will throw an exception
[18:53]<npyvnpjzan>and then i have to recreate the same socket with the same options for nothing
[18:53]<npyvnpjzan>if i wanna continue accepting
[18:54]<irbmn>yes.. but closing the socket is the only way of cancelling a call to [Begin]Accept
[18:55]<npyvnpjzan>ahm no, since i can set a socket to non blocking mode
[18:55]<npyvnpjzan>and accept doesnt block anymore
[18:56]<svzz[wjzc]>hm... struct ComboItem { int ID; string Name } List<ComboItem> Myitems; <filling Myitems> ; MyComboBox.Items.AddRange(Items); <-- Here, AddRange takes an object[] parameter... so i figured i could Items.ToArray(); but it cannot convert ComboItem to object... so is there another way than using MyItems.ConvertAll with a converter ?
[18:56]<azyfm>hm, interesting: "Microsoft SQL Server 2005 Everywhere Edition"
[18:56]<irbmn>eliteforce, I said it's the only way of cancelling it







