Re: Problem about multi-thread programming
On Saturday, 5 May 2012 at 18:46:32 UTC, David Nadlinger wrote: On Saturday, 5 May 2012 at 08:45:21 UTC, Tongzhou Li wrote: I wrote: http://codepad.org/K4xQOREZ Besides the other things mentioned, you also need to lock the monitor associated with a condition before notifying/waiting (cf. a recent discussion on the druntime list). David Why? There's no data races...
Re: Problem about multi-thread programming
On Saturday, 5 May 2012 at 17:03:00 UTC, Chris Cain wrote: On Saturday, 5 May 2012 at 09:28:34 UTC, Tongzhou Li wrote: On Saturday, 5 May 2012 at 09:16:04 UTC, Kagamin wrote: What's in console? object.Error: Access Violation Expected output: 12341234123 PS: Line 13 should be: write(Idx); By default, everything is TLS (thread local) ... so, cv[0] will be null in main even though another thread set it to something else. Adding __gshared in front of "Condition[4] cv;" on line 7 will make it not crash with the Access Violation. However, I highly recommend you read the concurrency chapter in the DPL book: http://www.informit.com/articles/article.aspx?p=1609144 Thanks. Now it works fine with gdc, but still prints nothing with dmd. It seems that "cv[0].notify()" on line 29 affects nothing at all when using dmd2 :(
Re: undefined reference - Derelict2
On Sunday, 6 May 2012 at 01:23:48 UTC, sergeiV wrote: On Saturday, 5 May 2012 at 23:42:36 UTC, sergeiV wrote: After succesful building of the Derelict libraries using: 'make -flinux.mak DC=dmd', I am unable to compile the provided example code: http://svn.dsource.org/projects/derelict/branches/Derelict2/doc/index.html They look like linker problems to me. rdmd test.d -Iinclude/Derelict2/import/ test.o:(.data+0x10): undefined reference to `_D8derelict6openal2al12__ModuleInfoZ' test.o:(.data+0x18): undefined reference to `_D8derelict6opengl2gl12__ModuleInfoZ' test.o: In function `_Dmain': test.d:(.text._Dmain+0x3d): undefined reference to `_D8derelict6openal2al10DerelictALC8derelict6openal2al16DerelictALLoader' test.d:(.text._Dmain+0x61): undefined reference to `_D8derelict6opengl2gl10DerelictGLC8derelict6opengl2gl16DerelictGLLoader' collect2: ld returned 1 exit status --- errorlevel 1 gdc gave an different kind of error: include/Derelict2/import/derelict/util/compat.di:64: Error: identifier 'c_long' is not defined Using a makefile generated errors similar to those for (r)dmd. dmd 2.059 derelict2 630 Solved, missed -of: rdmd -Iinclude/Derelict2/import/ -Linclude/Derelict2/lib/libDerelictAL.a -Linclude/Derelict2/lib/libDerelictUtil.a -ofderelict_test test.d This is ofcourse enough: rdmd -Iinclude/Derelict2/import/ -oftest test.d (rdmd -Iinclude/Derelict2/import/ test.d FAILS) Could anybody explain why an output file specification is necessary? Or is this a bug?
Re: undefined reference - Derelict2
On Saturday, 5 May 2012 at 23:42:36 UTC, sergeiV wrote: After succesful building of the Derelict libraries using: 'make -flinux.mak DC=dmd', I am unable to compile the provided example code: http://svn.dsource.org/projects/derelict/branches/Derelict2/doc/index.html They look like linker problems to me. rdmd test.d -Iinclude/Derelict2/import/ test.o:(.data+0x10): undefined reference to `_D8derelict6openal2al12__ModuleInfoZ' test.o:(.data+0x18): undefined reference to `_D8derelict6opengl2gl12__ModuleInfoZ' test.o: In function `_Dmain': test.d:(.text._Dmain+0x3d): undefined reference to `_D8derelict6openal2al10DerelictALC8derelict6openal2al16DerelictALLoader' test.d:(.text._Dmain+0x61): undefined reference to `_D8derelict6opengl2gl10DerelictGLC8derelict6opengl2gl16DerelictGLLoader' collect2: ld returned 1 exit status --- errorlevel 1 gdc gave an different kind of error: include/Derelict2/import/derelict/util/compat.di:64: Error: identifier 'c_long' is not defined Using a makefile generated errors similar to those for (r)dmd. dmd 2.059 derelict2 630 Solved, missed -of: rdmd -Iinclude/Derelict2/import/ -Linclude/Derelict2/lib/libDerelictAL.a -Linclude/Derelict2/lib/libDerelictUtil.a -ofderelict_test test.d
undefined reference - Derelict2
After succesful building of the Derelict libraries using: 'make -flinux.mak DC=dmd', I am unable to compile the provided example code: http://svn.dsource.org/projects/derelict/branches/Derelict2/doc/index.html They look like linker problems to me. rdmd test.d -Iinclude/Derelict2/import/ test.o:(.data+0x10): undefined reference to `_D8derelict6openal2al12__ModuleInfoZ' test.o:(.data+0x18): undefined reference to `_D8derelict6opengl2gl12__ModuleInfoZ' test.o: In function `_Dmain': test.d:(.text._Dmain+0x3d): undefined reference to `_D8derelict6openal2al10DerelictALC8derelict6openal2al16DerelictALLoader' test.d:(.text._Dmain+0x61): undefined reference to `_D8derelict6opengl2gl10DerelictGLC8derelict6opengl2gl16DerelictGLLoader' collect2: ld returned 1 exit status --- errorlevel 1 gdc gave an different kind of error: include/Derelict2/import/derelict/util/compat.di:64: Error: identifier 'c_long' is not defined Using a makefile generated errors similar to those for (r)dmd. dmd 2.059 derelict2 630
Get systype for FTP-cmd "TYPE"
I'm working on a small FTP-server and I'm now have to implement the "TYPE"- command which return the type of the system (for instance "UNIX L8")... but is there any chance to get type of the system using D? Is there any getSysType()- function? I was unable to find anything like that in Phobos...
Re: Problem about multi-thread programming
On Saturday, 5 May 2012 at 08:45:21 UTC, Tongzhou Li wrote: I wrote: http://codepad.org/K4xQOREZ Besides the other things mentioned, you also need to lock the monitor associated with a condition before notifying/waiting (cf. a recent discussion on the druntime list). David
Re: Problem about multi-thread programming
On Saturday, 5 May 2012 at 09:28:34 UTC, Tongzhou Li wrote: On Saturday, 5 May 2012 at 09:16:04 UTC, Kagamin wrote: What's in console? object.Error: Access Violation Expected output: 12341234123 PS: Line 13 should be: write(Idx); By default, everything is TLS (thread local) ... so, cv[0] will be null in main even though another thread set it to something else. Adding __gshared in front of "Condition[4] cv;" on line 7 will make it not crash with the Access Violation. However, I highly recommend you read the concurrency chapter in the DPL book: http://www.informit.com/articles/article.aspx?p=1609144
Re: c C deimos
On Saturday, 5 May 2012 at 10:53:59 UTC, Alex Rønne Petersen wrote: Small was always the convention. Not sure why mysql uses a big letter. Huh? ZeroMQ, ncurses, systemd, libmediainfo, libev, liblzma, libevent, OpenSSL, libexif, libsndfile and portaudio all use a capital »C« as directory name – and if anything, this has been »the convention«, as Walter's initial OpenSSL repo also used this variant. Not that it would matter, though, the directory only serve the purpose of documenting which exact version of the C headers was used to create the translation… David
Re: c C deimos
On Saturday, 5 May 2012 at 10:53:59 UTC, Alex Rønne Petersen wrote: Small was always the convention. Not sure why mysql uses a big letter. Huh? ZeroMQ, ncurses, systemd, libmediainfo, libev, liblzma, libevent, OpenSSL, libexif, libsndfile and portaudio all use a capital »C« as directory name – and if anything, this has been »the convention«, as Walter's initial OpenSSL repo also used this variant. Not that it would matter, though, the directory only serve the purpose of documenting which exact version of the C headers was used to create the translation… David
Re: c C deimos
On 05-05-2012 12:47, sclytrack wrote: Why does deimos have a small letter c and sometimes a big letter C? libmysql has the big letter C. Which one is going to be the official one? Small was always the convention. Not sure why mysql uses a big letter. -- - Alex
c C deimos
Why does deimos have a small letter c and sometimes a big letter C? libmysql has the big letter C. Which one is going to be the official one?
Re: Problem about multi-thread programming
On Saturday, 5 May 2012 at 09:16:04 UTC, Kagamin wrote: What's in console? object.Error: Access Violation Expected output: 12341234123 PS: Line 13 should be: write(Idx);
Re: Problem about multi-thread programming
What's in console?
Problem about multi-thread programming
Hello everyone! I'm learning D and trying to write some sample code in D. I wrote: http://codepad.org/K4xQOREZ It compiles well with dmd 2.0.59, but I got an error when running: object.Error: Access Violation Any one help? Thanks.